![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 60
Serena Chen
Life-long Learner. 记录学习过程,感谢大家指导和建议!
展开
-
LeetCode - Valid Palindrome II
11.08.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以部分用英文笔记,并无他意)Solution - Two pointers (Python)class Solution: def validPalindrome(self, s: str) -> bool: left = 0 right = len(s) - 1 while left <.原创 2021-08-12 01:51:02 · 87 阅读 · 0 评论 -
LeetCode - Dot Product of Two Sparse Vector
07.08.2021Approach 1 -Non-efficient Array Approach原创 2021-08-08 20:52:53 · 139 阅读 · 0 评论 -
LeetCode - Verifying an Alien Dictionary
04.08.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以部分用英文笔记,并无他意)This is Facebook most asked questionin 2020 and 2021, this is a sub-task of another Hard problem 'Alien Dictionary' which is much simpler. (ps: 一位YouTuber是这样说的但是我真的花了..原创 2021-08-05 06:10:48 · 136 阅读 · 0 评论 -
LeetCode - Merge Intervals
02.08.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以部分用英文笔记,并无他意)Solution 1 - sort it first (Python)Time complexity is O(nlogn), Space complexity is O(n)1. Sort the list by the first element2. Iterate intervals and do the l..原创 2021-08-03 03:36:41 · 211 阅读 · 0 评论 -
LeetCode - LRU Cache
01.08.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以部分用英文笔记,并无他意)cache : inmemory that holds the most recent result; LRU is a common cache algorithm1. When you see put and get, you shold think of Hashmap immediately which hasi...原创 2021-08-02 21:41:13 · 101 阅读 · 0 评论 -
LeetCode - Candy
25.07.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以部分用英文笔记,并无他意)Solution - Greedy algorithm (Java)We can use the greedy algorithm strategy to solve this problem by only considering the relationship of neighbors.1. Initializin.原创 2021-07-26 04:49:30 · 145 阅读 · 0 评论 -
LeetCode - Assign Cookies
25.07.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以部分用英文笔记,并无他意)class Solution { public int findContentChildren(int[] g, int[] s) { Arrays.sort(g); Arrays.sort(s); int child = 0, cookie = 0; w.原创 2021-07-26 00:03:19 · 54 阅读 · 0 评论 -
LeetCode - Palindrome Number
24.07.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以用英文笔记,并无他意)- Could you solve it without converting the integer to a string?Solution 1 - reverse the number (Java)Runtime:7 ms, faster than69.75%ofJavaonline submissions ...原创 2021-07-25 05:04:08 · 175 阅读 · 0 评论 -
LeetCode - Two Sum
23.07.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,感谢大家纠错与建议????(因留学顺便练习英语,所以用英文笔记,并无他意)1.Two SumSolution 0 - 2 for loops (Java)class Solution { public int[] twoSum(int[] nums, int target) { for (int i = 0; i < nums.length ; i++) {原创 2021-07-24 04:15:01 · 225 阅读 · 1 评论 -
LeetCode - Reverse Integer
24.07.2021小白一枚,文章仅当日记本记录学习进度 ;)如被浏览,请多多指教,非常感谢大家纠错与建议!(因留学顺便练习英语,所以用英文笔记,并无他意)Solution 1 - Pythonstep1: Assume we are dealing with an environment which could only stores integers within the 32-bits signed integer range. - Assume the funciton r.原创 2021-07-25 03:00:45 · 151 阅读 · 2 评论