随笔分类 -  Recursive

摘要:Special binary strings are binary strings with the following two properties: The number of 0's is equal to the number of 1's. Every prefix of the bina 阅读全文 »
posted @ 2019-04-26 21:22 Veritas_des_Liberty 阅读(393) 评论(0) 推荐(0) 编辑
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文 »
posted @ 2019-02-15 20:05 Veritas_des_Liberty 阅读(206) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is 阅读全文 »
posted @ 2019-02-05 00:31 Veritas_des_Liberty 阅读(215) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative integer N, find the largest number that is less than or equal to N with monotone increasing digits. (Recall that an integer has m 阅读全文 »
posted @ 2019-01-09 21:05 Veritas_des_Liberty 阅读(232) 评论(0) 推荐(0) 编辑
摘要:Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to 阅读全文 »
posted @ 2018-12-20 18:20 Veritas_des_Liberty 阅读(225) 评论(0) 推荐(0) 编辑
摘要: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. Example 阅读全文 »
posted @ 2018-12-10 18:00 Veritas_des_Liberty 阅读(205) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文 »
posted @ 2018-12-10 17:15 Veritas_des_Liberty 阅读(195) 评论(0) 推荐(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 阅读全文 »
posted @ 2018-12-10 12:05 Veritas_des_Liberty 阅读(191) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Exampl 阅读全文 »
posted @ 2018-12-09 21:13 Veritas_des_Liberty 阅读(202) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文 »
posted @ 2018-12-09 18:53 Veritas_des_Liberty 阅读(182) 评论(0) 推荐(0) 编辑
摘要:Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Input: [1,3,null,null,2 阅读全文 »
posted @ 2018-12-09 18:14 Veritas_des_Liberty 阅读(215) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文 »
posted @ 2018-11-23 15:50 Veritas_des_Liberty 阅读(173) 评论(0) 推荐(0) 编辑
摘要:Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algor 阅读全文 »
posted @ 2018-11-06 20:28 Veritas_des_Liberty 阅读(177) 评论(0) 推荐(0) 编辑
摘要:Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta 阅读全文 »
posted @ 2018-10-28 16:49 Veritas_des_Liberty 阅读(297) 评论(0) 推荐(0) 编辑
摘要:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati 阅读全文 »
posted @ 2018-10-26 21:24 Veritas_des_Liberty 阅读(189) 评论(0) 推荐(0) 编辑
摘要:Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Exampl 阅读全文 »
posted @ 2018-10-24 12:02 Veritas_des_Liberty 阅读(168) 评论(0) 推荐(0) 编辑
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: AC code: Runtime: 88 ms, faster than 42.24% of C++  阅读全文 »
posted @ 2018-10-24 11:03 Veritas_des_Liberty 阅读(277) 评论(0) 推荐(0) 编辑
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return the 阅读全文 »
posted @ 2018-10-18 22:16 Veritas_des_Liberty 阅读(173) 评论(0) 推荐(0) 编辑
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all 阅读全文 »
posted @ 2018-10-18 22:11 Veritas_des_Liberty 阅读(150) 评论(0) 推荐(0) 编辑
摘要:Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Example 2: Example 3: Note: -100.0 < x < 100.0 n is a 32-bit signed int 阅读全文 »
posted @ 2018-10-17 22:00 Veritas_des_Liberty 阅读(224) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示