about | help | code help+videos | done | prefs |
Write a method that returns the amount of fuel remaining in your space ship after flying to Mars (hopefully!). The integer input parameter indicates how much total fuel is needed for your ship to make it all the way to Mars. The integer array indicates how much fuel is used by each stage of the rocket. If there is not enough fuel to make it to Mars, return a -1 as a flag. jan19_2018_APSLHL_marsLaunch(45, [4, 15, 17]) → 9 jan19_2018_APSLHL_marsLaunch(12, [5, 72, 89, 121]) → -1 jan19_2018_APSLHL_marsLaunch(500, [300, 50, 150]) → 0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 280
Copyright Nick Parlante 2017 - privacy