- 博客(47)
- 资源 (5)
- 收藏
- 关注
原创 LeetCode——Palindrome Number
Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Java代码:
2014-11-21 10:58:25 285
原创 LeetCode——Search a 2D Matrix
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 le
2014-11-20 17:43:43 300
原创 LeetCode——Search for a Range
Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If
2014-11-20 17:40:37 341
原创 LeetCode——Sqrt(x)
Sqrt(x)Implement int sqrt(int x).Compute and return the square root of x.Java代码:
2014-11-20 17:28:35 280
原创 LeetCode——Search in Rotated Sorted Array II
Search in Rotated Sorted Array IIFollow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a
2014-11-20 17:02:07 353
原创 LeetCode——Search in Rotated Sorted Array
Search in Rotated Sorted ArraySuppose 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 targe
2014-11-20 16:57:53 293
原创 LeetCode——Merge Sorted Array
Merge Sorted ArrayGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n)
2014-11-20 16:38:59 422
原创 LeetCode——Rotate Image
Rotate ImageYou are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Java
2014-11-20 10:06:00 609
原创 LeetCode——Find Minimum in Rotated Sorted Array
Find Minimum in Rotated Sorted ArraySuppose 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).Find the minimu
2014-11-19 22:44:33 276
原创 LeetCode——Remove Duplicates from Sorted Array
Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra spac
2014-11-19 22:39:07 296
原创 LeetCode——Sort Colors
Sort ColorsGiven an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here
2014-11-19 21:35:05 349
原创 LeetCode——Gray Code
Gray CodeThe 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 cod
2014-11-19 17:05:17 547
原创 LeetCode——Min Stack
Min StackDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stac
2014-11-19 16:19:10 310
原创 LeetCode——String to Integer (atoi)
String to Integer (atoi)Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself
2014-11-19 15:09:49 341
原创 LeetCode——Swap Nodes in Pairs
Swap Nodes in PairsGiven 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 algorith
2014-11-19 14:30:37 266
原创 LeetCode——Remove Element
Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you lea
2014-11-19 13:06:01 281
原创 LeetCode——Search Insert Position
Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You
2014-11-18 21:07:52 265
原创 LeetCode——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.
2014-11-18 20:40:34 259
原创 LeetCode——Binary Tree Inorder Traversal
Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3retu
2014-11-18 19:58:37 294
原创 LeetCode——Best Time to Buy and Sell Stock II
Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may
2014-11-18 14:39:10 298
原创 LeetCode——Single Number
Single NumberGiven 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 i
2014-11-18 13:53:38 265
原创 LeetCode——Remove Duplicates from Sorted List
Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2
2014-11-18 09:38:59 269
原创 LeetCode——Maximum Depth of Binary Tree
Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf
2014-11-18 09:33:28 293
原创 LeetCode——Sort List
Sort ListSort a linked list in O(n log n) time using constant space complexity.
2014-11-17 19:55:09 291
原创 LeetCode——Count and Say
Count and SayThe 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 1
2014-11-16 12:13:51 385
原创 LeetCode——Reverse Integer
Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321
2014-11-16 09:26:33 409
原创 LeetCode——Word Break
Word BreakGiven 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 = "
2014-11-15 22:03:18 369
原创 LeetCode——Unique Paths II
Java代码:public class Solution { public int uniquePathsWithObstacles(int[][] obstacleGrid) { int m = obstacleGrid.length; int n = obstacleGrid[0].length; int [][]sum = new
2014-11-15 17:27:57 317
原创 LeetCode——Unique Paths
Unique PathsA robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The r
2014-11-15 17:08:14 327
原创 LeetCode——Best Time to Buy and Sell Stock
Best Time to Buy and Sell StockSay you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy
2014-11-15 15:37:44 336
单片机基本知识单片机基本知识,有助于初学者学习。希望对大家有帮助,谢谢
2010-06-04
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人