int[] a = {3, 1, 4, 1, 5, 9, 2, 6};
java.util.Arrays.sort(a);
int k = 4;
int kth = a[k - 1];What is the 4th smallest?
- A
4
- B
1
- C
2
- Dcheck_circle
3
Explanation
Sorted: {1,1,2,3,4,5,6,9}; index 3 holds 3.
AP Computer Science A· difficulty 3/5
int[] a = {3, 1, 4, 1, 5, 9, 2, 6};
java.util.Arrays.sort(a);
int k = 4;
int kth = a[k - 1];What is the 4th smallest?
4
1
2
3
Explanation
Sorted: {1,1,2,3,4,5,6,9}; index 3 holds 3.
Want 10 more like this — adaptive to your weak spots?