Question: Given two version numbers, version 1 and version 2 , compare them. Version numbers consist of one or more revisions joined by a dot '
Given two version numbers, version and version compare them.
Version numbers consist of one or more revisions joined by a dot Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. Revisions are indexed from left to right, with the leftmost revision being revision the next revision being revision and so on For example and are valid version numbers.
To compare version numbers, compare their revisions in lefttoright order. Revisions are compared using their integer value ignoring any leading zeros. This means that revisions and are considered equal. If a version number does not specify a revision at an index, then treat the revision as For example, version is less than version because their revision s are the same, but their revision s are and respectively, and
class Solution
public int compareVersionString version String version
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
