33. Search in Rotated Sorted Array 📄 Problem Statement : There is an integer array nums sorted in ascending order (with distinct values). Before being passed to your function, nums may be rotated at an unknown pivot index k (where 1 <= k < nums.length ) such that the array becomes [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] . You are given the array nums after the rotation and an integer target . Your task is to return the index of the target if it exists in nums , or return -1 if it does not exist. You must solve it in O(log n) time. 📚 Examples : Example 1 : Input: nums = [4,5,6,7,0,1,2], target = 0 Output: 4 Example 2 : Input: nums = [4,5,6,7,0,1,2], target = 3 Output: -1 Example 3 : Input: nums = [1], target = 0 Output: -1 📜 Constraints : 1 <= nums.length <= 5000 -10⁴ <= nums[i] <= 10⁴ All values of nums are unique . nums is a sorted array, possibly rotated . -10⁴ <= target <= 10⁴ ...
Mistakes to Avoid Before Coming to India for Study | Study Abroad Tips Mistakes to Avoid Before Coming to India for Study Studying in India can be a transformative experience, offering a unique cultural perspective and high-quality education. However, to make the most of your time in India, it’s crucial to prepare thoroughly and avoid common mistakes. Here’s a guide to help you avoid pitfalls and ensure a smooth transition to your studies in India. 1. Neglecting Visa and Documentation Requirements One of the most critical aspects of studying abroad is ensuring that you have the correct visa and documentation: Visa Application: Ensure you apply for the correct type of student visa. Check the specific requirements and processing times to avoid last-minute issues. For detailed visa requirements, visit the Indian Government's official visa website . Document Checklist: Prepare all necessary documents, s...
Comments
Post a Comment
If you have any suggestions then comment me .