Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* package whatever; // don't place package name! */
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- /* Name of the class has to be "Main" only if the class is public. */
- class Ideone
- {
- public static void main (String[] args) throws java.lang.Exception
- {
- // your code goes here
- //scores = [100, 100, 50, 40, 40, 20, 10]
- //alice = [5, 25, 50, 120]
- System.out.println(climbingLeaderboard([100, 100, 50, 40, 40, 20, 10], [5, 25, 50, 120]));
- }
- static int[] climbingLeaderboard(int[] scores, int[] alice)
- {
- int count = 0, res = 0;
- for (int i=0; i++; i<scores.length()-1):
- if (scores[i]>scores[i+1]):
- {
- count += 1;
- for (int j=0; j++; j<alice.length())
- {
- if (alice[i]>scores[i])
- {
- res = count;
- }
- else if (alice[i]<scores[])
- {
- res = count + 1;
- }
- }
- }
- return res;
- }
- }
Add Comment
Please, Sign In to add comment