1.You are given an array sorted in ascending order but rotated at some pivot unknown to you beforehand. 2.You are also given a target value to search. 3.You have to complete the function search() that should return the index of target, otherwise return -1.
Input Format
1.First line contains an Integer 'N'. 2.Second line contains N space separated elements. 3.Third line contains an Integer 'K' denoting the target.
Output Format
Return an Integer
Constraints
1<=N<=1000
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
7 4 5 6 7 0 1 2 0
Output
4