- 博客(15)
- 收藏
- 关注
原创 开始刷leetcode day49: Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node.
2015-06-25 11:26:00 330
转载 开始刷leetcode day47: Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2015-06-22 13:37:05 321
转载 开始刷leetcode day47:Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2015-06-22 11:38:21 276
转载 开始刷题leetcode day47: Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.java: publ
2015-06-22 11:01:12 407
原创 开始刷leetcode day42:Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur
2015-06-16 11:16:55 236
原创 开始刷leetcode day41:Implement strStr()
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The signature of the function had been updated
2015-06-15 09:47:10 258
原创 开始刷leetcode day40:Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(m
2015-06-14 14:44:22 281
原创 开始刷leetcode day40: Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each
2015-06-14 10:18:10 286
转载 开始刷题 leetcode day39:Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at
2015-06-12 13:01:02 280
原创 开始刷leetcode day38: Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo
2015-06-11 13:19:02 327
原创 开始刷题leetcode day37:Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node's key.Th
2015-06-10 14:01:53 313
原创 开始刷leetcode day32: Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.Java:/** * Definition for
2015-06-05 12:27:10 324
转载 开始刷leetcode day31:Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext
2015-06-04 12:11:42 285
原创 开始刷leetcode day30:Count and Say
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as
2015-06-03 14:57:36 327
原创 开始刷leetcode day29:Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2015-06-02 10:24:35 298
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人