摘要:
原题链接在这里:https://leetcode.com/problems/count-univalue-subtrees/ 题目: Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree me
阅读全文
posted @ 2016-02-13 05:19
Dylan_Java_NYC
阅读(687)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/largest-bst-subtree/ 题目: Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), wher
阅读全文
posted @ 2016-02-13 04:50
Dylan_Java_NYC
阅读(1999)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/wiggle-sort-ii/ 题目: Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]....
阅读全文
posted @ 2016-02-12 00:17
Dylan_Java_NYC
阅读(727)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/wiggle-sort/ 题目: Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nu
阅读全文
posted @ 2016-02-11 10:43
Dylan_Java_NYC
阅读(228)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/shortest-word-distance-iii/ 题目: This is a follow up of Shortest Word Distance. The only difference is now word1
阅读全文
posted @ 2016-02-11 10:16
Dylan_Java_NYC
阅读(235)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/shortest-word-distance-ii/ 题目: This is a follow up of Shortest Word Distance. The only difference is now you are
阅读全文
posted @ 2016-02-11 09:28
Dylan_Java_NYC
阅读(398)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/shortest-word-distance/ 题目: Given a list of words and two words word1 and word2, return the shortest distance be
阅读全文
posted @ 2016-02-11 04:39
Dylan_Java_NYC
阅读(317)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/flip-game-ii/ 题目: You are playing the following Flip Game with your friend: Given a string that contains only th
阅读全文
posted @ 2016-02-11 03:31
Dylan_Java_NYC
阅读(341)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/flip-game/description/ 题目: You are playing the following Flip Game with your friend: Given a string that contain
阅读全文
posted @ 2016-02-11 03:06
Dylan_Java_NYC
阅读(1129)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters/ 题目: Given a string, find the length of the longest subst
阅读全文
posted @ 2016-02-05 01:38
Dylan_Java_NYC
阅读(633)
推荐(0)
摘要:
火柴拼出多少个正方形 http://matchstickpuzzles.blogspot.com/2011/06/55-4x4-square-how-many-squares.html 输入是两个二维数组ver 和 hor, 若是有火柴就是1, 没有就是0. dpHor 表示横方向上有多少连续火柴,
阅读全文
posted @ 2016-01-31 23:39
Dylan_Java_NYC
阅读(391)
推荐(0)
posted @ 2016-01-27 23:15
Dylan_Java_NYC
阅读(333)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/bulb-switcher/ 题目: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off
阅读全文
posted @ 2016-01-23 16:38
Dylan_Java_NYC
阅读(299)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/maximum-product-of-word-lengths/用mark[i]数组来标记 words[i]都含有哪些字母,假若有个'c', 就在第三位上有个1.通过mark[i] & mark[j] 是否为0来确定是否有相...
阅读全文
posted @ 2016-01-22 12:08
Dylan_Java_NYC
阅读(302)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/rotate-array/ 题目: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the
阅读全文
posted @ 2016-01-21 16:53
Dylan_Java_NYC
阅读(237)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/summary-ranges/ 题目: Given a sorted integer array without duplicates, return the summary of its ranges. Example 1
阅读全文
posted @ 2016-01-18 17:24
Dylan_Java_NYC
阅读(264)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/string-to-integer-atoi/ 题目: Implement atoi which converts a string to an integer. The function first discards as
阅读全文
posted @ 2016-01-18 16:33
Dylan_Java_NYC
阅读(278)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/reverse-integer/ 题目: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output:
阅读全文
posted @ 2016-01-18 15:48
Dylan_Java_NYC
阅读(154)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/range-sum-query-mutable/ 题目: Given an integer array nums, find the sum of the elements between indices i and j (
阅读全文
posted @ 2016-01-18 14:40
Dylan_Java_NYC
阅读(378)
推荐(0)
摘要:
原题链接在这里:http://www.lintcode.com/en/problem/a-b-problem/不让用 数学运算符,就用位运算符。a的对应位 ^ b的对应位 ^ carry 就是res中的对应位。carry 更新为0还是1要分别讨论。Time Complexity: O(1), 一共3...
阅读全文
posted @ 2016-01-15 14:43
Dylan_Java_NYC
阅读(273)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/power-of-three/ 题目: Given an integer, write a function to determine if it is a power of three. Example 1: Exampl
阅读全文
posted @ 2016-01-08 22:32
Dylan_Java_NYC
阅读(305)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/pascals-triangle-ii/ 题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3
阅读全文
posted @ 2016-01-05 17:29
Dylan_Java_NYC
阅读(275)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/pascals-triangle/ 题目: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows
阅读全文
posted @ 2016-01-05 17:01
Dylan_Java_NYC
阅读(793)
推荐(0)
摘要:
QuickSortJava Code: 1 import java.util.*; 2 public class quickSort{ 3 public static void main(String [] args){ 4 int [] arr = new int[]{4,...
阅读全文
posted @ 2015-12-12 09:33
Dylan_Java_NYC
阅读(191)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/two-sum/ 题目: Given an array of integers, return indices of the two numbers such that they add up to a specific t
阅读全文
posted @ 2015-12-12 04:50
Dylan_Java_NYC
阅读(367)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/plus-one/ 题目: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.
阅读全文
posted @ 2015-12-05 05:09
Dylan_Java_NYC
阅读(378)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/valid-palindrome/ 题目: Given a string, determine if it is a palindrome, considering only alphanumeric characters
阅读全文
posted @ 2015-12-03 11:27
Dylan_Java_NYC
阅读(225)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/palindrome-number/ 题目:Determine whether an integer is a palindrome. Do this without extra space. 题解: div 表示能走到x的
阅读全文
posted @ 2015-12-03 10:58
Dylan_Java_NYC
阅读(189)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/path-sum/ 题目: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up a
阅读全文
posted @ 2015-11-20 14:37
Dylan_Java_NYC
阅读(287)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/merge-sorted-array/ 题目: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted ar
阅读全文
posted @ 2015-11-20 11:52
Dylan_Java_NYC
阅读(204)
推荐(0)
摘要:
HDS(11.16.2015):How to design an non-stop website like Google or Amazon?What design patterns are you using?Implement a queue with two stacks.Quick-sor...
阅读全文
posted @ 2015-11-17 04:09
Dylan_Java_NYC
阅读(210)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/contains-duplicate/ 题目: Given an array of integers, find if the array contains any duplicates. Your function sho
阅读全文
posted @ 2015-11-15 06:57
Dylan_Java_NYC
阅读(247)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/delete-node-in-a-linked-list/ 题目: Write a function to delete a node (except the tail) in a singly linked list, g
阅读全文
posted @ 2015-11-15 05:50
Dylan_Java_NYC
阅读(150)
推荐(0)
摘要:
What is the relationship and differences between processes and threads?A process usually represent an indepentdent execution unit with its own memory ...
阅读全文
posted @ 2015-11-14 06:46
Dylan_Java_NYC
阅读(161)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/range-sum-query-2d-immutable/ 题目: Given a 2D matrix matrix, find the sum of the elements inside the rectangle de
阅读全文
posted @ 2015-11-13 10:00
Dylan_Java_NYC
阅读(332)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/range-sum-query-immutable/ 题目: Given an integer array nums, find the sum of the elements between indices i and j
阅读全文
posted @ 2015-11-13 09:32
Dylan_Java_NYC
阅读(325)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/remove-invalid-parentheses/ 题目: Remove the minimum number of invalid parentheses in order to make the input stri
阅读全文
posted @ 2015-11-13 09:15
Dylan_Java_NYC
阅读(485)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/word-ladder-ii/ 题目: Given two words (beginWord and endWord), and a dictionary's word list, find all shortest tra
阅读全文
posted @ 2015-11-12 04:30
Dylan_Java_NYC
阅读(1178)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/wildcard-matching/ 题目: Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single
阅读全文
posted @ 2015-11-10 12:30
Dylan_Java_NYC
阅读(311)
推荐(0)
摘要:
原题链接在这里:https://leetcode.com/problems/regular-expression-matching/ 题目: Implement regular expression matching with support for '.' and '*'. 题解: When it
阅读全文
posted @ 2015-11-10 03:26
Dylan_Java_NYC
阅读(344)
推荐(0)