正确解法:用recursion,会让码变得简单一点。首先,在recursion function的开头来确定边界条件,如果有out of bound的情况,就马上return。再次就是,对于四个方向,都做一次dfs,并且在这里不需要用if来check边界条件,因为当我们再次进入这个方法的时候,在方法 ...
分类:
其他好文 时间:
2018-11-10 15:30:42
阅读次数:
129
Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing su... ...
分类:
其他好文 时间:
2018-11-06 11:21:00
阅读次数:
93
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], ...
分类:
其他好文 时间:
2018-11-05 16:22:34
阅读次数:
130
Given a complete binary tree, count the number of nodes. Note: Definition of a complete binary tree from Wikipedia: In a complete binary tree every le ...
分类:
其他好文 时间:
2018-11-05 16:20:47
阅读次数:
83
Farmer John and his brothers have found a new land. They are so excited and decide to build new farms on the land. The land is a rectangle and consist ...
分类:
其他好文 时间:
2018-11-04 16:15:58
阅读次数:
206
异常信息: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ...
分类:
其他好文 时间:
2018-11-02 11:09:18
阅读次数:
125
English: listening、speaking、reading、writing、translation 1. A beautiful life begins with a beautiful mind. 2. Anything is possible, as long as you set ...
分类:
其他好文 时间:
2018-11-01 01:03:44
阅读次数:
240
Description The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can affo ...
分类:
其他好文 时间:
2018-10-30 20:02:28
阅读次数:
164
B. Maxim and Restaurant time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output B. Maxim and Res ...
分类:
其他好文 时间:
2018-10-28 23:02:06
阅读次数:
260
Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta ...
分类:
其他好文 时间:
2018-10-28 17:58:32
阅读次数:
184