Skip to content

Commit 590b43d

Browse files
committed
issue #27 Intro to Tutorial Challenges java
1 parent 3558013 commit 590b43d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package hackerrank;
2+
3+
public class IntrotoTutorialChallenges {
4+
static int introTutorial(int V, int[] arr) {
5+
int i = 0;
6+
for(i=0; i<arr.length;i++){
7+
if(arr[i] == V){
8+
break;
9+
}
10+
}
11+
return i;
12+
}
13+
public static void main(String[] args) {
14+
System.out.println(introTutorial(3, new int[]{1,2,3})+", ans: 2");
15+
System.out.println(introTutorial(4, new int[]{1, 4, 5, 7, 9, 12})+", ans: 1");
16+
}
17+
}

0 commit comments

Comments
 (0)