代码改变世界

[LeetCode] 877. Stone Game == [LintCode] 396. Coins in a Line 3_hard tag: 区间Dynamic Programming, 博弈

2018-08-01 01:24 by Johnson_强生仔仔, 852 阅读, 0 推荐, 收藏, 编辑
摘要:Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of sto 阅读全文

[LeetCode] 42. Trapping Rain Water_hard tag: Two Pointers

2018-07-28 01:26 by Johnson_强生仔仔, 236 阅读, 0 推荐, 收藏, 编辑
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文

[LintCode] 395. Coins in a Line 2_Medium tag: Dynamic Programming, 博弈

2018-07-26 00:34 by Johnson_强生仔仔, 323 阅读, 0 推荐, 收藏, 编辑
摘要:Description There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no more c 阅读全文

[LintCode] 394. Coins in a Line_ Medium tag:Dynamic Programming_博弈

2018-07-25 23:16 by Johnson_强生仔仔, 314 阅读, 0 推荐, 收藏, 编辑
摘要:Description There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The playe 阅读全文

[LeetCode] 329. Longest Increasing Path in a Matrix_Hard tag: Dynamic Programming, DFS, Memoization

2018-07-25 06:25 by Johnson_强生仔仔, 263 阅读, 0 推荐, 收藏, 编辑
摘要:Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do 阅读全文

[LeetCode] 331. Verify Preorder Serialization of a Binary Tree_Medium tag: stack

2018-07-25 05:19 by Johnson_强生仔仔, 295 阅读, 0 推荐, 收藏, 编辑
摘要:One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, 阅读全文

[LeetCode] 255. Verify Preorder Sequence in Binary Search Tree_Medium tag: Preorder Traversal, tree

2018-07-24 06:06 by Johnson_强生仔仔, 273 阅读, 0 推荐, 收藏, 编辑
摘要:Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree. You may assume each number in the seq 阅读全文

[LeetCode] 106. Construct Binary Tree from Postorder and Inorder Traversal_Medium tag: Tree Traversal

2018-07-24 04:23 by Johnson_强生仔仔, 224 阅读, 0 推荐, 收藏, 编辑
摘要:Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, 阅读全文

[LeetCode] 105. Construct Binary Tree from Preorder and Inorder Traversal_Medium tag: Tree Traversal

2018-07-24 04:11 by Johnson_强生仔仔, 259 阅读, 0 推荐, 收藏, 编辑
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, 阅读全文

[LeetCode] 285. Inorder Successor in BST_Medium tag: Inorder Traversal

2018-07-24 01:09 by Johnson_强生仔仔, 227 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary search tree and a node in it, find the in-order successor of that node in the BST. Note: If the given node has no in-order successor in 阅读全文
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 39 下一页