You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// we are checking from left to right that if the element next to our current element has greater rating, if yes then we are increasing their candy
8
9
for(inti = 0; i<ratings.length-1; i++){
9
10
if(ratings[i] < ratings[i+1])
10
11
left[i+1] = left[i]+1;
11
12
}
12
-
13
+
13
14
int[] right = newint[ratings.length];
14
15
Arrays.fill(right, 1);
15
-
16
+
16
17
//we are checking from right to left if the element after than our current element is greater or not , if yes then we are also checking their candies if greater rating has less number of candies then increasing their candy
0 commit comments