随笔分类 - Leetcode
Leetcode: Most Stones Removed with Same Row or Column
摘要:If stone a and stone b are in the same column/row, we connect them as a component The largest possible number of moves we can make = the number of uni
阅读全文
Leetcode: 24 Game
摘要:Backtracking: every time draw two cards, calculate the possible results, and add one result to the nextRound list. The nextRound list will have the re
阅读全文
Leetcode: Capacity To Ship Packages Within D Days
摘要:Exactly the same with Split Array Largest Sum. Binary search or DP Binary Search
阅读全文
Leetcode: Stream of Characters
摘要:Store the words in the trie with reverse order, and check the query string from the end
阅读全文
Leetcode: Backspace String Compare
摘要:Complexity Analysis Time Complexity: O(M + N)O(M+N), where M, NM,N are the lengths of S and T respectively. Space Complexity: O(1)O(1). Time Complexit
阅读全文
Leetcode: Shortest Way to Form String
摘要:Greedy Use two pointers, one for source: i, one for target: j. While j scan through target, try to match each char of j in source by moving i. Count h
阅读全文
Leetcode: Campus Bikes II
摘要:Basic: Backtracking + pruning DP: refer to https://leetcode.com/problems/campus-bikes-ii/discuss/305218/DFS-%2B-Pruning-And-DP-Solution state : dp[i][
阅读全文
浙公网安备 33010602011771号