MCPcopy Create free account
hub / github.com/careercup/ctci / shrinkLeft

Method shrinkLeft

java/Chapter 17/Question17_6/Question.java:23–31  ·  view source on GitHub ↗
(int[] array, int min_index, int start)

Source from the content-addressed store, hash-verified

21 }
22
23 public static int shrinkLeft(int[] array, int min_index, int start) {
24 int comp = array[min_index];
25 for (int i = start - 1; i >= 0; i--) {
26 if (array[i] <= comp) {
27 return i + 1;
28 }
29 }
30 return 0;
31 }
32
33 public static int shrinkRight(int[] array, int max_index, int start) {
34 int comp = array[max_index];

Callers 1

findUnsortedSequenceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected