55 lines
954 B
Python
55 lines
954 B
Python
from string import *
|
|
from re import *
|
|
from datetime import *
|
|
from collections import *
|
|
from heapq import *
|
|
from bisect import *
|
|
from copy import *
|
|
from math import *
|
|
from random import *
|
|
from statistics import *
|
|
from itertools import *
|
|
from functools import *
|
|
from operator import *
|
|
from io import *
|
|
from sys import *
|
|
from json import *
|
|
from builtins import *
|
|
import string
|
|
import re
|
|
import datetime
|
|
import collections
|
|
import heapq
|
|
import bisect
|
|
import copy
|
|
import math
|
|
import random
|
|
import statistics
|
|
import itertools
|
|
import functools
|
|
import operator
|
|
import io
|
|
import sys
|
|
import json
|
|
from typing import *
|
|
|
|
|
|
# @leet start
|
|
class Solution:
|
|
def findMin(self, nums: List[int]) -> int:
|
|
l = 0
|
|
h = len(nums) - 1
|
|
while l <= h:
|
|
if l == h:
|
|
return nums[l]
|
|
mid = (l + h) // 2
|
|
if nums[mid] > nums[h]:
|
|
l = mid + 1
|
|
else:
|
|
h = mid
|
|
|
|
|
|
|
|
# @leet end
|
|
|