<s>[INST] class Solution:
    def findMin(self, nums: List[int]) -> int:
        left, right = 0, len(nums) - 1
        while left < right:
            mid = left + (right - left) // 2
            if nums[mid] > nums[right]:
                left = mid + 1
            else:
                right = mid
        return nums[left]

The code above is for searching the first element in the rotated sorted array which is the smallest. 

However, I am trying to find the last element in the rotated sorted array, which is the largest. Can I simply change the condition `if nums[mid] > nums[right]` to `if nums[mid] < nums[left]` and return `nums[right]` instead of `nums[left]`?[/INST]