dfs
Opium_Z
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Leetcode 199 Binary Tree Right Side View
Problem:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.Input: [1,2,3,null,5,null,4]Output: [1, 3, 4]E...原创 2019-04-06 06:57:00 · 140 阅读 · 0 评论 -
Leetcode 17 Letter Combinations of a Phone Number
problem:Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters is just like on the telephone butto...翻译 2019-04-03 12:22:04 · 162 阅读 · 0 评论 -
Leetcode 91 Decode Ways
Problem:A message containing letters from A-Z is being encoded to numbers using the following mapping:‘A’ -> 1‘B’ -> 2…‘Z’ -> 26Given a non-empty string containing only digits, determin...原创 2019-04-10 04:58:28 · 155 阅读 · 0 评论 -
Leetcode 200 Number of Islands
Problem:Analysisscan grid to find ‘1’if ‘1’, then dfs or bfs and labelCodeclass Solution1 { // 1. scan grid 2.if ==1, dfs and label final static int[][] dirs = {{1,0},{-1,0},{0,1},...原创 2019-06-07 13:20:00 · 158 阅读 · 0 评论 -
Leetcode Permutation
ProblemGive a string, like “abc”, return all the possible combinations (all the chars are different)example:input: “abc”output: [abc, acb, bac, bca, cab, cba]Analysisobviously, this problem can ...原创 2019-06-07 23:36:09 · 264 阅读 · 0 评论 -
Leetcode 124. Binary Tree Maximum Path Sum
Problem:Analysis:In this problem, I gonna use DFS to solve it. By using recursion, we should set up the base rule and recursive rule.there is a small trick in this problem, we should pass the int[...原创 2019-06-26 04:02:15 · 159 阅读 · 0 评论
分享