Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test1
- def solution(a, b)
- max = 100000000
- if a >= 0 && b >= 0
- aArray = a.to_s.split('').map(&:to_i)
- bArray = b.to_s.split('').map(&:to_i)
- cArray = Array.new
- aArray.each do |el|
- cArray = cArray.push(aArray[el-1])
- cArray = cArray.push(bArray[el-1])
- end
- c = cArray.join.to_i
- if c > max
- puts "no ok"
- return -1
- else
- puts c
- return c
- end
- else
- return -1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement