题目描述: 提交: class Solution: def hasAllCodes(self, s: str, k: int) -> bool: k_list = set() if k > len(s): return False for i in range(len(s) - k + 1): if ...
分类:
其他好文 时间:
2020-06-01 10:21:20
阅读次数:
69
使用了long。没有解决int的溢出问题。 class Solution { public: int divide(int dividend, int divisor) { //if (dividend == 0) return 0; //if (divisor == 1) return divid ...
分类:
其他好文 时间:
2020-05-31 18:17:56
阅读次数:
101
5424. 数组中两元素的最大乘积 理解错误,无脑暴力了一发居然过了 class Solution { public: int maxProduct(vector<int>& nums) { int res=0; for(int i=0;i<nums.size()-1;++i) { for(int ...
分类:
其他好文 时间:
2020-05-31 17:59:14
阅读次数:
49
class Solution { public: int lengthOfLongestSubstring(string s) { int res=0,rul=1; map <char, int> word; for(int i=1;i<=s.length();++i){ if(word[s[i-1 ...
分类:
其他好文 时间:
2020-05-31 15:45:25
阅读次数:
54
#博主的 BiBi 时间 简直不敢相信自己去年 $9$ 月学过主席树。。。真的一点印象都没了(真的太菜了)。 另外,这题有个坑点:\(testcase\) 是数据编号,不是数据组数! #Solution 主席树一般是处理区间第几大/小的问题。然而这次的场景转移到了树上。 我们可以让 \(rt[u]\ ...
分类:
其他好文 时间:
2020-05-31 13:13:42
阅读次数:
52
可以是弯的,那不就是左右相加了吗?要跟之前节点的值比较时,此时可以把节点值node.val作为参数。这是这题特殊的地方。 想错了的一个地方:既然返回的是要拿来用的、用来计算的,就应该是DC left = traverse(root.left)这样 class Solution { int lengt ...
分类:
其他好文 时间:
2020-05-31 11:21:05
阅读次数:
64
#Linova and Kingdom 题目链接:[https://pintia.cn/problem-sets/994805046380707840/problems/1111914599412858880) ###涉及知识点: 思维/字符串 ###solution: \(我们需要判断这个第一句古 ...
分类:
其他好文 时间:
2020-05-30 15:53:23
阅读次数:
58
转置加翻转 思路: 先把矩阵转置,然后把每一行元素翻转。即遍历元素,交换matrix[i][j]和matrix[j][i],然后翻转每一个子数组。 代码: class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ D ...
分类:
其他好文 时间:
2020-05-30 12:57:18
阅读次数:
57
799639 - IDES - General Information about the usage of IDES systems Symptom IDES Demo System Other Terms IDES for customers Solution information will ...
分类:
其他好文 时间:
2020-05-30 12:44:50
阅读次数:
73
使用散链表的字符串连接法。 class Solution { public: vector<string> fizzBuzz(int n) { vector<string> ans; //Hash map to store all fizzbuzz mappings. map<int, string ...
分类:
其他好文 时间:
2020-05-30 12:43:38
阅读次数:
59