Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def higherVersion(ver1, ver2)
- array1 = Array.new
- array2 = Array.new
- array1 = ver1.split('.')
- array2 = ver2.split('.')
- x = 0
- while (x < array1.length)
- if array1[x].to_i > array2[x].to_i and x == 0 then
- return true
- end
- if x > 0 then
- if array1[x - 1].to_i == array2[x - 1].to_i and array1[x].to_i > array2[x].to_i then
- return true
- end
- end
- x = x + 1
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment