Pergunta de entrevista da empresa Careem

Problem: Search in a Rotated Sorted Array You are given a sorted array of distinct integers that has been rotated at an unknown pivot (e.g., [4,5,6,7,0,1,2]). Write a function to search for a target value in this array. If the target exists, return its index; otherwise, return -1. You must achieve O(log n) runtime complexity.