摘要:
题目描述: 自己的提交: class Solution: def minCostToMoveChips(self, chips: List[int]) -> int: res = float('inf') nums = set(chips) for num in nums: ans = 0 for 阅读全文
摘要:
题目描述: 方法一:双栈 class MyQueue: def __init__(self): """ Initialize your data structure here. """ from collections import deque self.stack = deque() def pu 阅读全文
摘要:
题目描述: 第一次提交: class Solution: def isPowerOfTwo(self, n: int) -> bool: if n==0:return False if n==1: return True s = str(bin(n))[3:] for i in s: if i == 阅读全文
摘要:
题目描述: 第一次提交:双指针 O(N) class Solution: def summaryRanges(self, nums: List[int]) -> List[str]: #first = 0 last = 0 res = [] while last!=len(nums): first 阅读全文