2021年9月15日
摘要: Link: https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ Constraints 1 <= preorder.length <= 3000 inorder.length 阅读全文
posted @ 2021-09-15 21:00 blackraven25 阅读(20) 评论(0) 推荐(0) 编辑
  2021年8月10日
摘要: Link: https://leetcode.com/problems/missing-number/ Constraints: n == nums.length 1 <= n <= 104 0 <= nums[i] <= n All the numbers of nums are unique. 阅读全文
posted @ 2021-08-10 20:19 blackraven25 阅读(36) 评论(0) 推荐(0) 编辑
摘要: Link: https://leetcode.com/problems/top-k-frequent-elements/ Constraints: 1 <= nums.length <= 105 k is in the range [1, the number of unique elements 阅读全文
posted @ 2021-08-10 18:48 blackraven25 阅读(19) 评论(0) 推荐(0) 编辑
摘要: Link: https://leetcode.com/problems/top-k-frequent-words/ Code class Solution { public List<String> topKFrequent(String[] words, int k) { Map<String, 阅读全文
posted @ 2021-08-10 18:21 blackraven25 阅读(20) 评论(0) 推荐(0) 编辑
  2021年8月8日
摘要: Link: https://leetcode.com/problems/partition-list/ Idea Create two lists, one for keeping track of nodes with value smaller than x, the other for kee 阅读全文
posted @ 2021-08-08 21:35 blackraven25 阅读(29) 评论(0) 推荐(0) 编辑
摘要: Link: https://leetcode.com/problems/reorder-list/ Idea Find the middle point of the list and divide the list into two parts by setting mid.next = null 阅读全文
posted @ 2021-08-08 21:08 blackraven25 阅读(21) 评论(0) 推荐(0) 编辑
摘要: Link: https://leetcode.com/problems/merge-two-sorted-lists/ Constarints: The number of nodes in both lists is in the range [0, 50]. -100 <= Node.val < 阅读全文
posted @ 2021-08-08 16:58 blackraven25 阅读(11) 评论(0) 推荐(0) 编辑
摘要: Link: https://leetcode.com/problems/linked-list-cycle-ii/ Idea If there's a cyle, we have the following findings: Here 'a' means the distance from hea 阅读全文
posted @ 2021-08-08 16:41 blackraven25 阅读(18) 评论(0) 推荐(0) 编辑
摘要: Link: https://leetcode.com/problems/linked-list-cycle/ Constraints: Idea Using the two pointers technique, slow and fast would point to the same node 阅读全文
posted @ 2021-08-08 12:11 blackraven25 阅读(21) 评论(0) 推荐(0) 编辑
摘要: Link: https://leetcode.com/problems/middle-of-the-linked-list/ Constraints: The number of nodes in the list is in the range [1, 100]. 1 <= Node.val <= 阅读全文
posted @ 2021-08-08 12:04 blackraven25 阅读(17) 评论(0) 推荐(0) 编辑