You are given a sorted array ’nums’ which may have been rotated at an unknown pivot. Your task is to search for a target value in this rotated array. Return the index of the target if found, or -1 if not found. The solution must have a runtime complexity of O(log n).
Given a sorted array ’nums’ in non-decreasing order, find the starting and ending index of a target value. If the target is not found, return [-1, -1]. Your solution must run in O(log n) time complexity.
Given a sorted array of distinct integers and a target value, return the index of the target if it is present. If the target is not in the array, return the index where it should be inserted to maintain the sorted order.
You are given an m x n matrix where each row is sorted in non-decreasing order, and the first integer of each row is greater than the last integer of the previous row. Given a target integer, return true if the target exists in the matrix or false otherwise. The solution must have a time complexity of O(log(m * n)).
You are given a sorted integer array nums that has been rotated at an unknown pivot index k. The array may contain duplicates. Your task is to determine whether a given target exists in the array, minimizing the number of operations as much as possible.