MCPcopy
hub / github.com/careercup/ctci / rankB

Method rankB

java/Chapter 18/Question18_6/QuestionC.java:9–13  ·  view source on GitHub ↗
(int[] array, int rank)

Source from the content-addressed store, hash-verified

7public class QuestionC {
8
9 public static int rankB(int[] array, int rank) {
10 int[] cloned = array.clone();
11 Arrays.sort(cloned);
12 return cloned[rank];
13 }
14
15 public static void swap(int[] array, int i, int j) {
16 int t = array[i];

Callers 1

mainMethod · 0.95

Calls 2

cloneMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected