Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Version Checker

By faiyaz26 · Limits 1s, 512 MB

Java Development Kit (JDK) installer for Mac OS X has a bug:

Can you spot it? Notice how Java is checking the operating system version number. Logic dictates that 10.10.5 is obviously a newer version than 10.7.3. So something is incorrect in the way the installer trying to compare the version numbers. Can you come up with a correct algorithm? Do you have what it takes to get this right?


There will be only one line with two version strings. Each version number can have no dots or at most two (.) dots. And there will be at most two consecutive digits (0 - 9) in the given version number.


You need to print out the latest version number comparing the given two versions. If the both version numbers are the same print the string that is longest in terms of string length.


10.11.12 10.99.99
11.1 1.11

In the second sample case 1.11 can be considered as 01.11.00 and 11.1 can be considered as 11.01.00.



58% Solution Ratio

musa.cse12Earliest, May '16

Tarik.amtolyFastest, 0.0s

TSRaihanLightest, 0 B

bokaifShortest, 152B


Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.