You are viewing a single comment's thread. Return to all comments →
if i take input as string
the how will you print the numbers inside it
you need to use the equivalent of Java's Big Integer after processing the string and parsing it into numbers. Or, in languages like Ruby and Python, you don't need to do anything special to handle very large numbers, much of the time.
Do we really need to parse it into numbers. We can simply take Char 2D array and input each integer as a string. Then divide this string into individual characters (there are multiple ways of doing that). Comparison also works fine if we keep it to char array because ascii value of (char) '9' > '8' > '7' ...'2' > '1'
I tried this one in CPP my code reduced from 75+ lines to 25 lines.