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

Method magicSlow

java/Chapter 9/Question9_3/QuestionB.java:9–16  ·  view source on GitHub ↗
(int[] array)

Source from the content-addressed store, hash-verified

7public class QuestionB {
8
9 public static int magicSlow(int[] array) {
10 for (int i = 0; i < array.length; i++) {
11 if (array[i] == i) {
12 return i;
13 }
14 }
15 return -1;
16 }
17
18 public static int magicFast(int[] array, int start, int end) {
19 if (end < start || start < 0 || end >= array.length) {

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected