MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Method main

Java/Leetcode/Leetcode34.java:4–12  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

2
3public class Leetcode34 {
4 public static void main(String[] args) {
5 int[] arr={2,5,7,9,9,9,9,10,12,16};
6 int target=9;
7 int first=search(arr,target,true);
8 int last=search(arr,target,false);
9 System.out.println("First Occurence At="+first);
10 System.out.println("Last Occurence At="+last);
11
12 }
13
14 static int search(int[] arr, int target,boolean isStart){
15 int start=0,end=arr.length-1;int ans=-1;

Callers

nothing calls this directly

Calls 1

searchMethod · 0.95

Tested by

no test coverage detected