Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. class Test1
  2. def solution(a, b)
  3. max = 100000000
  4. if a >= 0 && b >= 0
  5. aArray = a.to_s.split('').map(&:to_i)
  6. bArray = b.to_s.split('').map(&:to_i)
  7. cArray = Array.new
  8. aArray.each do |el|
  9. cArray = cArray.push(aArray[el-1])
  10. cArray = cArray.push(bArray[el-1])
  11. end
  12. c = cArray.join.to_i
  13. if c > max
  14. puts "no ok"
  15. return -1
  16. else
  17. puts c
  18. return c
  19. end
  20. else
  21. return -1
  22. end
  23. end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement