give array integer num sort ascending order integer target write function search target num if target exist return index otherwise return 1you write algorithm Olog n runtime complexity Example 1input num 1035912 target 9output 4explanation 9 exist num index 4Example 2Input num 1035912 target 2output 1explanation 2 exist num return 1 Constraints1 numslength 104104 numsi target 104All integer num uniquenum sort ascending order