We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63dd50c commit 68c5900Copy full SHA for 68c5900
transition_point.cpp
@@ -0,0 +1,21 @@
1
+/*This is a function problem.You only need to complete the function given below*/
2
+
3
+int helper(int arr[], int strt, int end){
4
+ while(strt <= end){
5
+ int mid = strt + (end - strt)/2;
6
+ if(arr[mid] == 1 && arr[mid - 1] == 0)
7
+ return mid;
8
+ else if(arr[mid] == 1)
9
+ end = mid - 1;
10
+ else
11
+ strt = mid + 1;
12
+ }
13
+ return -1;
14
+}
15
16
+int transitionPoint(int arr[],int n)
17
+{
18
+// Your code goes here
19
+ int strt = 0, end = n -1;
20
+ return helper(arr, strt, end);
21
0 commit comments