摘要: 原题链接 1 class Solution { 2 public: 3 string modifyString(string s) { 4 int lens = s.length(); 5 for(int i = 0; i < lens; ++i) { 6 if(s[i] == '?') { 7 i 阅读全文
posted @ 2021-01-24 15:42 凝视深空 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 原题链接 1 class Solution: 2 def isSubsequence(self, s: str, t: str) -> bool: 3 lens,lent = len(s),len(t) 4 i = j = 0 5 while i < lens and j < lent: 6 if 阅读全文
posted @ 2021-01-24 13:29 凝视深空 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 原题链接 1 class Solution: 2 def findLengthOfLCIS(self, nums: List[int]) -> int: 3 ans = begin = 0 4 for i in range(len(nums)): 5 if i > 0 and nums[i] <= 阅读全文
posted @ 2021-01-24 13:02 凝视深空 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 原题链接 begin为最长不含重复字符的子字符串的起点 1 class Solution: 2 def lengthOfLongestSubstring(self, s: str) -> int: 3 begin,ans,dic = 0,0,{} 4 for index,c in enumerate 阅读全文
posted @ 2021-01-24 12:33 凝视深空 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 原题链接 1 class Solution: 2 def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: 3 ans,tmp = [],[] 4 def helper(root,sum): 5 if not root:retur 阅读全文
posted @ 2021-01-19 12:20 凝视深空 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 原题链接 1 class Solution: 2 def sortedArrayToBST(self, nums: List[int]) -> TreeNode: 3 l,r = 0,len(nums)-1 4 def helper(left,right): 5 root = None 6 if l 阅读全文
posted @ 2021-01-19 08:31 凝视深空 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 环境:Windows10 cmd: pip install xlrd xlwt 读操作 import xlrd #打开工作表,xxx为excel表格名称 workbook = xlrd.open_workbook('xxx.xlsx') #打开excel表格的第i+1个工作簿 sheet1 = wo 阅读全文
posted @ 2021-01-17 15:23 凝视深空 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 升序 import random l = [] for i in range(8): l.append(random.randint(0,9)) print(l) for cur in range(1,len(l)): tmp = l[cur] index = cur while index >= 阅读全文
posted @ 2021-01-17 10:01 凝视深空 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> //大数相加 2 using namespace std; 3 4 int main() 5 { 6 string a, b, res; 7 cin >> a >> b; 8 int i, k, inc, lena, lenb, temp; 9 阅读全文
posted @ 2019-01-29 22:02 凝视深空 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题目 代码 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 int cnt = 0; 6 7 void getNumVec(vector<int>& v, string s) 8 { 9 int temp = 0, flag = 1; 阅读全文
posted @ 2019-01-28 20:51 凝视深空 阅读(220) 评论(0) 推荐(0) 编辑