MCPcopy Index your code
hub / github.com/careercup/ctci / isUnique

Method isUnique

java/Chapter 18/Question18_6/QuestionC.java:54–63  ·  view source on GitHub ↗
(int[] array)

Source from the content-addressed store, hash-verified

52 }
53
54 public static boolean isUnique(int[] array) {
55 int[] cloned = array.clone();
56 Arrays.sort(cloned);
57 for (int i = 1; i < cloned.length; i++) {
58 if (cloned[i] == cloned[i - 1]) {
59 return false;
60 }
61 }
62 return true;
63 }
64
65 public static int max(int[] array, int left, int right) {
66 int max = Integer.MIN_VALUE;

Callers 2

mainMethod · 0.95
1_1_Spec.jsFile · 0.80

Calls 2

cloneMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected