This commit is contained in:
@@ -17,7 +17,11 @@ public class BinarySearch3637 {
|
||||
|
||||
int start = searchIterativeDecreasing(x, a);
|
||||
int end = searchIterativeIncreasing(x, a.getReversed());
|
||||
System.out.println(((end - start) == -1) ? 0 : (end - start));
|
||||
if (a.get(start) != x) {
|
||||
System.out.println(0);
|
||||
} else {
|
||||
System.out.println(end - start);
|
||||
}
|
||||
}
|
||||
|
||||
static int searchIterativeIncreasing(int x, IntList a) {
|
||||
|
||||
Reference in New Issue
Block a user