代码改变世界

[LeetCode] 62. Unique Paths_ Medium tag: Dynamic Programming

2018-07-19 05:56 by Johnson_强生仔仔, 246 阅读, 0 推荐, 收藏, 编辑
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文

[LeetCode] 394. Decode String_Medium tag: stack 666

2018-07-19 04:42 by Johnson_强生仔仔, 182 阅读, 0 推荐, 收藏, 编辑
摘要:Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is b 阅读全文

[LeetCode] 721. Accounts Merge_Medium tag: DFS recursive

2018-07-19 04:03 by Johnson_强生仔仔, 298 阅读, 0 推荐, 收藏, 编辑
摘要:Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements a 阅读全文

[LeetCode] 549. Binary Tree Longest Consecutive Sequence II_ Medium tag: DFS recursive

2018-07-18 09:07 by Johnson_强生仔仔, 287 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, you need to find the length of Longest Consecutive Path in Binary Tree. Especially, this path can be either increasing or decreas 阅读全文

[LeetCode] 298. Binary Tree Longest Consecutive Sequence_Medium tag: DFS recursive

2018-07-18 06:44 by Johnson_强生仔仔, 205 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any 阅读全文

[LeetCode] 687. Longest Univalue Path_Medium tag: DFS recursive

2018-07-18 06:25 by Johnson_强生仔仔, 211 阅读, 0 推荐, 收藏, 编辑
摘要:Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the roo 阅读全文

[LeetCode] 124. Binary Tree Maximum Path Sum_ Hard tag: DFS recursive, Divide and conquer

2018-07-18 05:47 by Johnson_强生仔仔, 257 阅读, 0 推荐, 收藏, 编辑
摘要:Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any 阅读全文

[LeetCode] 437. Path Sum III_ Medium tag: DFS

2018-07-18 00:38 by Johnson_强生仔仔, 279 阅读, 0 推荐, 收藏, 编辑
摘要:You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文

[LeetCode] questions conclustion_Path in Tree

2018-07-18 00:29 by Johnson_强生仔仔, 351 阅读, 0 推荐, 收藏, 编辑
摘要:Path in Tree: [LeetCode] 112. Path Sum_Easy tag: DFS input: root, target, return True if exists sum(root-> leaf) == target else False 1 [LeetCode] 257 阅读全文

[LeetCode] 221. Maximal Square _ Medium Tag: Dynamic Programming

2018-07-17 06:44 by Johnson_强生仔仔, 259 阅读, 0 推荐, 收藏, 编辑
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: 3.2) skip left and up, jus 阅读全文