Hacker Rank Solutions: Utopian Tree Hacker Rank Solutions: Utopian Tree 1 2 3 4 5 6 7 8 9 10 11 12 13 14 test_cases = $stdin.gets.chomp.to_i test_cases.times do years = $stdin.gets.chomp sum = 1 years.to_i.times do |i| if i % 2 == 0 sum *= 2 else sum += 1 end end $stdout.puts sum end