02 2021 档案
摘要:题目链接 https://leetcode-cn.com/problems/string-to-integer-atoi/ 截取字符然后乘10操作即可,坑点在于溢出判断,可以用MAX_INT/10与该数比较。 自己写的代码比较蠢,有漏洞,但数据可能比较水所以过了。官方题解是自动机,学会了再来写。。
阅读全文
摘要:链接 https://leetcode-cn.com/problems/fair-candy-swap/ 思路:假设从A中拿出y给B,从B中拿出x给A,则sumA+x-y=sumB-x+y, 即y=(sumA-sumB)/2+x public int[] fairCandySwap(int[] A,
阅读全文
摘要:链接 https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 思路一:双指针+HashSet 官方题解 class Solution { public int lengthOfLongestSu
阅读全文

浙公网安备 33010602011771号