Skip to content

33. Search in Rotated Sorted Array#43

Open
dxxsxsxkx wants to merge 1 commit into153_find_minimum_in_rotated_sorted_arrayfrom
33_search_in_rotated_sorted_array
Open

33. Search in Rotated Sorted Array#43
dxxsxsxkx wants to merge 1 commit into153_find_minimum_in_rotated_sorted_arrayfrom
33_search_in_rotated_sorted_array

Conversation

@dxxsxsxkx
Copy link
Copy Markdown
Owner

Copy link
Copy Markdown

@huyfififi huyfififi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良いと思います。Step 1 でされていた方法しか練習していなかったので、use_minが勉強になりました 📝


while (left <= right) {
int mid = left + (right - left) / 2;
int real_mid = (mid + pivot) % nums.size();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

私だったら actual_mid と名付けるかなと思いました。

return -1;
}
private:
int findPivot(std::vector<int>& nums) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numsを変更しないので const をつけても良いかもしれないです

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants