title: Determine the minimum number of jumps that are required to go from the tallest platform to the ith platform
body: <p>There are N platforms in a row, each with a unique height. You are given the platforms in the form of an array A of size N, where the height of the ith platform is A[i] (1&lt;=i&lt;=N). You can perform the following operation:</p>
  <p>If you are standing on the ith platform, you can jump on any jth platform such that the height of the ith platform is greater than the height of the jth platform, and there is no platform between the ith and jth platforms whose height is greater than the jth platform.</p>
  <p>Determine the minimum number of jumps that are required to go from the tallest platform to the ith platform (for each valid i)</p>
  <p>Notes</p>
  <p>You have to answer for each valid i independently.</p>
  <p>• Assume 1-based indexing,</p>
  <p>• The height of each platform is unique.</p>
  <p>Explanation</p>
  <p>The first line contains the number of the test cases, T = 2.</p>
  <p>For the first test case</p>
  <p>Given</p>
  <p>N = 4</p>
  <p>A = [13, 5]</p>
  <p>Approach</p>
  <p>• For the 1st platform, jump from the 2nd platform directly to the 1st platform. Hence 1 jump is required.</p>
  <p>• For the 2nd platform, you are already on the 2nd platform, hence 0 jumps are required.</p>
  <p>For the second test case</p>
  <p>Given</p>
  <p>• N = 5</p>
  <p>• A = [5, 1, 3, 4,7]</p>
  <p>Approach</p>
  <p>• For the 1st platform, jump from the 5th platform directly to the 1st platform. Hence 1 jump is required.</p>
  <p>• For the 2nd platform, jump from the 5th platform to the 1st platform, then jump to the 2nd platform. Hence 2 jumps are required.</p>
  <p>• For the 3rd platform, jump from the 5th platform to the 4th platform, then jump to the 3rd platform. Hence 2 jumps are required.</p>
  <p>• For the 4th platform, jump from the 5th platform directly to the 4th platform. Hence 1 jump is required.</p>
  <p>• For the 5th platform, you are already on the 5th platform hence 0 jumps are required.</p>
  <p><em>I tried to solve the question but couldn't reach to the correct solution. Can anyone please help me solve it.</em></p>
  <pre><code>//Function to find the index of max number in array
      static int Tallest(int[] arr)
   {
     //since have to use 1based indexing
       int max = 0;
  
       for (int i = 1; i &lt; arr.length; i++)
           if (arr[i] &gt; arr[max])
               max = i;
  
       return max;
   }  
                           
  static int[] Min_Jumps(int N, int[] A)
   {
     int[] result = {0};
     int count = 0;
     int tall = Tallest(A);
       for(int i=1;i&lt;N;i++)
        {
       if(i == tall)
         {
           result[i] = 0;
         }
       else 
           {
               count = tall - i;
               result[i] = count;
           }
       }
        return result;
    }
  </code></pre>