def convert_nt_a number number .to_s .split('') .reverse .map { |num| num.to_i } end # TESTS require "test/unit" class ConvertNtATest < Test::Unit::TestCase def test_convert_nt_a assert_equal [7,9,5,8,4,3], convert_nt_a(348597) assert_equal [4, 5, 5, 1, 8, 5, 6], convert_nt_a(6581554) assert_equal [6, 5, 4, 3, 2, 1], convert_nt_a(123456) assert_equal [3, 2, 1, 7, 8, 9], convert_nt_a(987123) end end #1 tests, 4 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
ruby