Compare Version Numbers Need Solution

Need help in solving the following problem asked here.

Compare two version numbers version1 and version2.

  • If version1 > version2 return 1,
  • If version1 < version2 return -1,
  • otherwise return 0.

 

Here is an example of version numbers ordering:
0.1 < 1.1 < 1.2 < 1.13 < 1.13.4
Add Comment


  • LATEST ANSWERS

  • 0 Answer(s)

    Write your answer

    By posting your answer, you agree to the privacy policy and terms of service.