LeetCode problem solution code
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
contest
differentType
leetcode-1~100
leetcode-500+
.gitignore
README.md

README.md

LeetCodeDaily

LeetCode problem solution code. There are two form for you to find the solution by Type or Label.
Notes:

  1. "♥" means it seems a little hard for me, just for me, maybe not for you.
  2. "♠" means it seems easy to be solved, but it exists some better approachs to decrease the Time Complexity or Space Complexity.
  3. "♣" means it is a mathematics problem or it needs you to look for patterns.
  4. "♦" means...

By Label

# Title Solution Difficulty Feelings
695 Max Area of Island java Medium 这里数组不大,应该用dfs,并标记已访问的,不应该用动态规划的,这里推不出状态方程
694 Number of Distinct Islands java Medium 关键是怎么计算两个island是不是相同,这里一个方法是深度优先遍历时,向左向右向上和向下时分别乘以一个不同素数,这样如果两个island一模一样的话,那么乘积的结果是相同的,这样就可以统计出不重复的island
648 Replace Words java Medium ...
647 Palindromic Substrings java Medium ...
646 Maximum Length of Pair Chain java Medium ...
645 Set Mismatch java Easy ...
644 Maximum Average Subarray II "♥" java Hard ...
643 Maximum Average Subarray I "♠" java Easy ...
526 Beautiful Arrangement "♠" java Medium 感觉题目不难,用全排列方法,剔除不符合的部分,或者用回溯
309 Best Time to Buy and Sell Stock with Cooldown "♥" java Medium ...
188 Best Time to Buy and Sell Stock IV java Hard ...
123 Best Time to Buy and Sell Stock III "♥" java Hard ...
122 Best Time to Buy and Sell Stock II java Easy ...
121 Best Time to Buy and Sell Stock java Easy ...
120 Triangle java Medium ...
117 Populating Next Right Pointers in Each Node II java Medium 层次遍历,记住每层的个数,以及下一层的个数,这里不能用递归,因为不是完全二叉树,不能直接递归,还有一种直接用三个指针,不需要记录层数个数
116 Populating Next Right Pointers in Each Node java Medium 层次遍历,记住每层的个数,以及下一层的个数,或者用递归,这里递归有个很好的方法
96 Unique Binary Search Trees java Hard ...
95 Unique Binary Search Trees II "♥" java Medium ...
91 Decode Ways java Medium ...
67 Add Binary java Easy 直接转换为10进制数会越界,看似简单实则还需要点时间来写写
59 Spiral Matrix II java Medium ...
58 Length of Last Word java Easy ...
56 Merge Intervals "♠" java Medium ...
55 Jump Game java Medium ...
54 Spiral Matrix java Medium ...
52 N-Queens java Hard 这题和51题一样,但是写起来还是挺困难的
51 N-Queens java Hard 典型回退,了解怎么样才是皇后不能被互相攻击到
50 Pow(x, n) java Medium 有个坑需要注意,负数指数时
49 Group Anagrams "♠" java Medium ...
48 Rotate Image "♣ java Medium ...
45 Jump Game II"♥" java Hard ...

By Type

Dynamic Programming

# Title Solution Difficulty
45 45. Jump Game II"♥" java Hard
91 Decode Ways java Medium
95 Unique Binary Search Trees II "♥" java Medium
96 Unique Binary Search Trees java Hard
120 Triangle java Medium
121 Best Time to Buy and Sell Stock java Easy
188 Best Time to Buy and Sell Stock IV java Hard
123 Best Time to Buy and Sell Stock III "♥" java Hard
309 Best Time to Buy and Sell Stock with Cooldown "♥" java Medium
646 Maximum Length of Pair Chain java Medium

Backtrack/DFS

# Title Solution Difficulty
51 N-Queens java Hard
52 N-Queens java Hard
96 Unique Binary Search Trees java Hard
526 Beautiful Arrangement "♠" java Medium
694 Number of Distinct Islands java Medium
695 Max Area of Island java Medium

Arrays/Greedy

# Title Solution Difficulty
45 45. Jump Game II"♥" java Hard
48 Rotate Image "♣ java Medium
54 Spiral Matrix java Medium
55 Jump Game java Medium
59 Spiral Matrix II java Medium
645 Set Mismatch java Easy

Binary Search

# Title Solution Difficulty
50 Pow(x, n) java Medium
644 Maximum Average Subarray II "♥" java Hard

String

# Title Solution Difficulty
49 Group Anagrams "♠" java Medium
58 Length of Last Word java Easy
67 Add Binary java Easy
647 Palindromic Substrings java Medium
648 Replace Words java Medium

LeetCode Contest

Contest

Contest 35

Contest 34

Contest 34

Contest 36

Contest 42

四道题,难度都不大,分别考察了,数组,回文字符串,二维数组,动态规划。
| # | Title | Solution | Difficulty | |---| ----- | -------- | ---------- | |648|Replace Words|java|Medium| |647|Palindromic Substrings|java|Medium| |646|Maximum Length of Pair Chain|java|Medium| |645|Set Mismatch|java|Easy|