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

Method getNextSlow

java/Chapter 5/Question5_3/Question.java:49–59  ·  view source on GitHub ↗
(int i)

Source from the content-addressed store, hash-verified

47 }
48
49 public static int getNextSlow(int i) {
50 if (!hasValidNext(i)) {
51 return -1;
52 }
53 int num_ones = countOnes(i);
54 i++;
55 while (countOnes(i) != num_ones) {
56 i++;
57 }
58 return i;
59 }
60
61 public static int getPrevSlow(int i) {
62 if (!hasValidPrev(i)) {

Callers 1

mainMethod · 0.95

Calls 2

hasValidNextMethod · 0.95
countOnesMethod · 0.95

Tested by

no test coverage detected