Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def alphanumericLess(s1, s2)
- x = 0
- string1 = ""
- string2 = ""
- while (x < s1.length)
- if s1[x] != '0' then
- string1 = string1 + s1[x]
- end
- x = x + 1
- end
- x = 0
- while (x < s2.length)
- if s2[x] != '0' then
- string2 = string2 + s2[x]
- end
- x = x + 1
- end
- if string1.length < string2.length then
- return true
- end
- if string1 == string2 then
- if s1.length > s2.length then
- return true
- else
- return false
- end
- end
- if string1 < string2 then
- return true
- else
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment