코딩테스트 준비/leetcode

81. Search in Rotated Sorted Array II

MAKGA 2021. 8. 28. 21:17
320x100

https://leetcode.com/problems/search-in-rotated-sorted-array-ii/

 

Search in Rotated Sorted Array II - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

목록와 정수가 주어졌을 때, 정수만큼 rotate를 하고 그 안에서 해당 정수가 있는지 찾는 문제라고 이해했는데 그게 무슨 의미인지 모르겠다.. 그냥 찾으면 되지 않나;;


class Solution {
public:
    bool search(vector<int>& nums, int target) {
        return find(nums.begin(), nums.end(), target) != nums.end();
    }
};

320x100