title: Hackerrank: Climbing the Leaderboard
body: <p>i have a deal with a <a href="https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem" rel="nofollow noreferrer">hackerrank algorithm problem</a>. </p>
  
  <p>It works at all cases, except 6-7-8-9. It gives timeout error. I had spent so much time at this level. Someone saw where is problem?</p>
  
  <pre><code>static long[] climbingLeaderboard(long[] scores, long[] alice)  
  {
      //long[] ranks = new long[scores.Length];
      long[] aliceRanks = new long[alice.Length]; // same length with alice length
      long lastPoint = 0;
      long lastRank;
      for (long i = 0; i &lt; alice.Length; i++)
      {
          lastPoint = scores[0];
          lastRank = 1;
          bool isIn = false; // if never drop in if statement 
          for (long j = 0; j &lt; scores.Length; j++)
          {
              if (lastPoint != scores[j])  //if score is not same, raise the variable
              {
                  lastPoint = scores[j];
                  lastRank++;
              }
  
              if (alice[i] &gt;= scores[j])
              {
                  aliceRanks[i] = lastRank;
                  isIn = true;
                  break;
              }
              aliceRanks[i] = !isIn &amp; j + 1 == scores.Length ? ++lastRank : aliceRanks[i]; //drop in here
          }
      }
      return aliceRanks;
  }
  </code></pre>