Ad
  • Custom User Avatar

    Great, I'm glad it makes sense. Good luck!

  • Custom User Avatar

    That is not right, as your path starts at the montain of height 1 and ends at the mountain of height 6, so energy it took is at least 6 - 1 = 5. Energy constain in my example is E = 3.

  • Custom User Avatar

    I think the longest mountain pass in your example is [1,2,3,4,6,6] so the answer should be (6,2), because 5=(2-1)+(3-2)+(4-3)+(6-4)+(6-6). No?

  • Custom User Avatar

    You are given a mountain range (an array of mountain heights) and your task is to find the longest mountain pass (the longest subarray given the energy constrain).

    For example, for a given energy constrain E = 3 and a given mountain range = [2, 5, 1, 2, 3, 4, 6, 6] the longest mountain pass you can take is [5, 1, 2, 3, 4], which has length 5. You would return the tuple (5, 1).