Commit 40cc566
Changed files (1)
2020
10
20
2020/10/20/main.rb
@@ -0,0 +1,18 @@
+require 'minitest'
+require 'minitest/autorun'
+
+class Solution
+ def self.run(items, jumps = 0)
+ return jumps if items.nil? || items.empty?
+
+ run(items[items[1..items[0]].max..-1], jumps+1)
+ end
+end
+
+
+class SolutionTest < MiniTest::Test
+ def test_simple_example
+ # 3 -> 5 -> 4
+ assert_equal Solution.run([3, 2, 5, 1, 1, 9, 3, 4]), 2
+ end
+end