摘要:
1 class Solution: 2 def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: 3 n = len(nums) 4 result = [] 5 for i in range(n): 6
阅读全文
posted @ 2020-03-22 12:35
Sempron2800+
阅读(151)
推荐(0)
摘要:
1 class Solution: 2 def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int: 3 n1,n2 = len(arr1),len(arr2) 4 result = 0 5 for
阅读全文
posted @ 2020-03-22 12:34
Sempron2800+
阅读(188)
推荐(0)
摘要:
1 class Solution: 2 def __init__(self): 3 self.result = TreeNode(-1) 4 5 def preOrder(self,node,target): 6 if node != None: 7 if node.val == target.va
阅读全文
posted @ 2020-03-21 19:23
Sempron2800+
阅读(168)
推荐(0)
摘要:
1 class CustomStack: 2 def __init__(self, maxSize: int): 3 self.maxSize = maxSize 4 self.stack = [0] * maxSize 5 self.position = -1 6 7 def push(self,
阅读全文
posted @ 2020-03-21 19:10
Sempron2800+
阅读(126)
推荐(0)
摘要:
1 class Solution { 2 int maxpath = 0; 3 HashMap<TreeNode, Integer> map1 = new HashMap<TreeNode, Integer>(); 4 HashMap<TreeNode, Integer> map2 = new Ha
阅读全文
posted @ 2020-03-21 18:03
Sempron2800+
阅读(168)
推荐(0)
摘要:
1 class Solution { 2 public int findTheLongestSubstring(String s) { 3 int n = s.length(); 4 Map<Character, Integer> map = new HashMap<>(); 5 map.put('
阅读全文
posted @ 2020-03-19 09:50
Sempron2800+
阅读(335)
推荐(0)
摘要:
1 import sys 2 class Solution: 3 def luckyNumbers (self, matrix: List[List[int]]) -> List[int]: 4 m = len(matrix) 5 n = len(matrix[0]) 6 luckyset = se
阅读全文
posted @ 2020-03-15 12:54
Sempron2800+
阅读(173)
推荐(0)
摘要:
1 class Solution: 2 def numTimesAllBlue(self, light: 'List[int]') -> int: 3 right,res = 0,0 4 for i, a in enumerate(light, start=1): 5 right = max(rig
阅读全文
posted @ 2020-03-08 13:10
Sempron2800+
阅读(145)
推荐(0)
摘要:
1 class Solution: 2 def generateTheString(self, n: int) -> str: 3 if n == 1: 4 return 'a' 5 elif n == '2': 6 return 'ab' 7 else: 8 if n % 2 == 0: 9 re
阅读全文
posted @ 2020-03-08 13:08
Sempron2800+
阅读(220)
推荐(0)
摘要:
1 class Solution: 2 def sortString(self, s: str) -> str: 3 n = len(s) 4 dic = {} 5 for i in range(n): 6 if s[i] not in dic: 7 dic[s[i]] = 1 8 else: 9
阅读全文
posted @ 2020-03-08 03:31
Sempron2800+
阅读(162)
推荐(0)