Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ad9be85

Browse files
author
Ram swaroop
committed
todo
1 parent c9bc6fc commit ad9be85

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/me/ramswaroop/arrays/CountSmallerElementsOnRHS.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,13 @@
1212
public class CountSmallerElementsOnRHS {
1313

1414
public static int[] getSmallerElementsCountOnRHSNaive(int[] a) {
15-
int[] result = new int[a.length];
16-
int i, j, temp;
17-
for (i = a.length - 2; i >= 0; i--) {
18-
for (j = i + 1; a[i] < a[j]; j++) {
19-
temp = a[i];
20-
a[i] = a[j];
21-
a[j] = temp;
22-
}
23-
result[i] = j - i;
24-
}
25-
return result;
15+
// TODO
16+
return null;
2617
}
2718

2819
public static void main(String a[]) {
2920
System.out.println(Arrays.toString(getSmallerElementsCountOnRHSNaive(new int[]{12, 1, 2, 3, 0, 11, 4})));
21+
System.out.println(Arrays.toString(getSmallerElementsCountOnRHSNaive(new int[]{5, 4, 3, 2, 1})));
22+
System.out.println(Arrays.toString(getSmallerElementsCountOnRHSNaive(new int[]{1, 2, 3, 4, 5})));
3023
}
3124
}

0 commit comments

Comments
 (0)