LeetCode 编程训练的积累,目前在努力做题中,日后整理!
<!– more –>
1 maxCount
1 | func maxCount(m int, n int, ops [][]int) int { |
1 | func maxCount(m int, n int, ops [][]int) int { |
1 | func main() { |
2 lengthOfLongestSubstring
1 | func lengthOfLongestSubstring(s string) int { |
1 | func main() { |
3 findMedianSortedArrays
1 | func findMedianSortedArrays(nums1 []int, nums2 []int) float64 { |
1 | func main() { |
4 findMin
1 | func findMin(nums []int) int { |
5 findDiagonalOrder
1 | func findDiagonalOrder(matrix [][]int) []int { |
6 thirdMax
1 | func parent(i int) int { |
1 | func main() { |
7 combinationSum
7.1 combinationSum
1 | type PreCombin struct { |
1 | func main() { |
7.2 combinationSum2
1 | type PreCombin struct { |
1 | func main() { |
7.3 combinationSum3
1 | type PreCombin struct { |
1 | func main() { |
7.4 combinationSum4
7.4.1 V1
1 | type PreCombin struct { |
7.4.2 V2
1 | func permut_num(num_M map[int]int) int { |
1 | func main() { |
7.4.3 V3
动态规划解法
- dp[i] += dp[i-num]
- dp[i+num] += dp[i]
1 | func combinationSum4(nums []int, target int) int { |
1 | func main() { |
8 combine
1 | func combine(n int, k int) [][]int { |
1 | func main() { |
9 pathSum
9.1 hasPathSum
1 | type TreeNode struct { |
1 | func main() { |
9.2 pathSum
1 | type TreeNode struct { |
1 | func main() { |
9.3 number of path
1 | type TreeNode struct { |
1 | func main() { |
9.4 min path sum
1 | func minPathSum(grid [][]int) int { |
1 | func main() { |
9.5 binary-tree maximum path sum
1 | type TreeNode struct { |
1 | func main() { |
9.6 sum root to leaf numbers
1 | type TreeNode struct { |
1 | func main() { |
10 poor pigs
1 | func poorPigs(buckets int, minutesToDie int, minutesToTest int) int { |
Render by hexo-renderer-org with Emacs 25.3.2 (Org mode 8.2.10)