摘要: 原题俩接在这里:https://leetcode.com/problems/ugly-number-ii/ 题目: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime 阅读全文
posted @ 2015-09-15 06:21 Dylan_Java_NYC 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/ugly-number/ 题目: Write a program to check whether a given number is an ugly number. Ugly numbers are positive nu 阅读全文
posted @ 2015-09-15 06:07 Dylan_Java_NYC 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/powx-n/ 题目: Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Input: 2.00000, 10 Ou 阅读全文
posted @ 2015-09-15 03:00 Dylan_Java_NYC 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/perfect-squares/ 题目: Given a positive integer n, find the least number of perfect square numbers (for example, 1 阅读全文
posted @ 2015-09-15 00:51 Dylan_Java_NYC 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/sqrtx/ 题目: Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non 阅读全文
posted @ 2015-09-15 00:21 Dylan_Java_NYC 阅读(310) 评论(0) 推荐(0) 编辑
摘要: Check if a given number is a perfect square with only addition orsubstraction operation.eg. 25 returns true; 19 returns false.Perfect square number 有一... 阅读全文
posted @ 2015-09-14 02:43 Dylan_Java_NYC 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/unique-paths-ii/ 题目: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram be 阅读全文
posted @ 2015-09-14 01:39 Dylan_Java_NYC 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/unique-paths/ 题目: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below 阅读全文
posted @ 2015-09-13 07:47 Dylan_Java_NYC 阅读(355) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/palindrome-partitioning-ii/ 题目: Given a string s, partition s such that every substring of the partition is a pa 阅读全文
posted @ 2015-09-13 05:19 Dylan_Java_NYC 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/palindrome-partitioning/ 题目: Given a string s, partition s such that every substring of the partition is a palin 阅读全文
posted @ 2015-09-13 02:22 Dylan_Java_NYC 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/word-break-ii/ 题目: Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, ad 阅读全文
posted @ 2015-09-13 01:40 Dylan_Java_NYC 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/word-break/ 题目: Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a 阅读全文
posted @ 2015-09-12 06:49 Dylan_Java_NYC 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/triangle/ 题目: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent 阅读全文
posted @ 2015-09-12 03:08 Dylan_Java_NYC 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/house-robber-ii/ 题目: Note: This is an extension of House Robber. After robbing those houses on that street, the 阅读全文
posted @ 2015-09-11 11:30 Dylan_Java_NYC 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/house-robber/ 题目: You are a professional robber planning to rob houses along a street. Each house has a certain 阅读全文
posted @ 2015-09-11 10:18 Dylan_Java_NYC 阅读(370) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/climbing-stairs/ 题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can eith 阅读全文
posted @ 2015-09-11 09:51 Dylan_Java_NYC 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/binary-tree-maximum-path-sum/ 题目: Given a non-empty binary tree, find the maximum path sum. For this problem, a 阅读全文
posted @ 2015-09-11 07:09 Dylan_Java_NYC 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/unique-binary-search-trees-ii/ 题目: Given an integer n, generate all structurally unique BST's (binary search tre 阅读全文
posted @ 2015-09-11 03:11 Dylan_Java_NYC 阅读(1013) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/unique-binary-search-trees/ 题目: Given n, how many structurally unique BST's (binary search trees) that store val 阅读全文
posted @ 2015-09-11 02:21 Dylan_Java_NYC 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/validate-binary-search-tree/ 题目: Given a binary tree, determine if it is a valid binary search tree (BST). Assum 阅读全文
posted @ 2015-09-10 23:05 Dylan_Java_NYC 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/recover-binary-search-tree/description/ 题目: T Two elements of a binary search tree (BST) are swapped by mistake. 阅读全文
posted @ 2015-09-10 07:04 Dylan_Java_NYC 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/ 题目: Given a binary tree Populate each next pointer to point to i 阅读全文
posted @ 2015-09-10 04:52 Dylan_Java_NYC 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ 题目: You are given a perfect binary tree where all leaves are on the 阅读全文
posted @ 2015-09-10 02:48 Dylan_Java_NYC 阅读(536) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/binary-tree-right-side-view/ 题目: Given a binary tree, imagine yourself standing on the right side of it, return 阅读全文
posted @ 2015-09-10 02:16 Dylan_Java_NYC 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/kth-smallest-element-in-a-bst/description/ 题目: Given a binary search tree, write a function kthSmallest to find 阅读全文
posted @ 2015-09-09 09:08 Dylan_Java_NYC 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/flatten-binary-tree-to-linked-list/description/ 题目: Given a binary tree, flatten it to a linked list in-place. F 阅读全文
posted @ 2015-09-09 08:03 Dylan_Java_NYC 阅读(428) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/count-complete-tree-nodes/ 题目: Given a complete binary tree, count the number of nodes. Definition of a complete 阅读全文
posted @ 2015-09-09 00:48 Dylan_Java_NYC 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/sum-root-to-leaf-numbers/ 题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could 阅读全文
posted @ 2015-09-07 22:29 Dylan_Java_NYC 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/path-sum-ii/ 题目: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the giv 阅读全文
posted @ 2015-09-07 04:14 Dylan_Java_NYC 阅读(561) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/binary-tree-paths/ 题目: Given a binary tree, return all root-to-leaf paths. For example, given the following bina 阅读全文
posted @ 2015-09-06 12:53 Dylan_Java_NYC 阅读(312) 评论(0) 推荐(0) 编辑
摘要: To convert a int to string:int num = 123;String str = String.valueOf(num);To convert a string to int:String str = "123";int num = Integer.valueOf(str)... 阅读全文
posted @ 2015-09-06 12:41 Dylan_Java_NYC 阅读(272) 评论(0) 推荐(0) 编辑
摘要: Java 的 annotation 以@开头 比如@Override. 不改变complied program的action annotation不完全是comments 能够改变一段代码compile的方式 下面这段代码因为base class里没有display(int x), 所以是用@Ove 阅读全文
posted @ 2015-09-06 12:02 Dylan_Java_NYC 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ 题目: Given a binary tree, find the lowest common ancestor (LCA) of two g 阅读全文
posted @ 2015-09-05 05:11 Dylan_Java_NYC 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ 题目: Given a binary search tree (BST), find the lowest common anc 阅读全文
posted @ 2015-09-05 04:52 Dylan_Java_NYC 阅读(296) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/invert-binary-tree/ 题目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 题解: 既可以自顶向下 阅读全文
posted @ 2015-09-05 02:27 Dylan_Java_NYC 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/symmetric-tree/ 题目: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center 阅读全文
posted @ 2015-09-05 02:06 Dylan_Java_NYC 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ 题目: Given a binary tree, return the bottom-up level order traversal of its 阅读全文
posted @ 2015-09-05 01:47 Dylan_Java_NYC 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/same-tree/ 题目: Given two binary trees, write a function to check if they are equal or not. Two binary trees are 阅读全文
posted @ 2015-09-05 01:24 Dylan_Java_NYC 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/minimum-depth-of-binary-tree/ 题目: Given a binary tree, find its minimum depth. The minimum depth is the number o 阅读全文
posted @ 2015-09-05 01:07 Dylan_Java_NYC 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/maximum-depth-of-binary-tree/ 题目: Given a binary tree, find its maximum depth. The maximum depth is the number o 阅读全文
posted @ 2015-09-05 00:49 Dylan_Java_NYC 阅读(241) 评论(0) 推荐(0) 编辑