leetcode168】的更多相关文章

Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB ... Example 1: Input: 1 Output: "A" Example 2: Input: 28 Output: "…
给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB ... 示例 1: 输入: 1 输出: "A" 示例 2: 输入: 28 输出: "AB" 示例 3: 输入: 701 输出: "ZY" class Solution { public String convertToTitle(int n)…
public class Solution { private string Convert(int k) { var s = ""; switch (k) { : s = "A"; break; : s = "B"; break; : s = "C"; break; : s = "D"; break; : s = "E"; break; : s = "F"; bre…
题目描述: 自己的提交: class Solution: def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int: c = collections.Counter() for i in range(len(s)-minSize+1): if len(set(s[i:i+minSize])) <= maxLetters: c[s[i:i+minSize]] += 1 if not c: retur…
题目描述: 方法一:bfs class Solution: def maxCandies(self, status: List[int], candies: List[int], keys: List[List[int]], containedBoxes: List[List[int]], initialBoxes: List[int]) -> int: n=len(status) ans=0 cur=initialBoxes cont=True while cont: cont=False n…
题目描述: 方法一:O(N) class Solution: def findNumbers(self, nums: List[int]) -> int: ans=0 for num in nums: if len(str(num))%2==0: ans+=1 return ans 方法二:数学 O(N) class Solution: def findNumbers(self, nums: List[int]) -> int: return sum(1 for num in nums if…
题目描述: 自己的提交: class Solution: def isPossibleDivide(self, nums: List[int], k: int) -> bool: c = collections.Counter(nums) n = len(nums) m = n/k if m%1 != 0: return False while m != 0: x = k pre = min(i for i,v in c.items() if v > 0) -1 while x: if c[p…
168. Excel表列名称 168. Excel Sheet Column Title 题目描述 给定一个正整数,返回它在 Excel 表中相对应的列名称. LeetCode168. Excel Sheet Column Title 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB ... 示例 1: 输入: 1 输出: "A" 示例 2: 输入: 28 输出: "AB"…