- 博客(33)
- 收藏
- 关注
原创 【小熊刷题】Remove Nth Node From End of List <Leetcode 19, Java>
QuestionGiven a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked
2015-09-12 04:15:25
285
原创 【小熊刷题】Letter Combinations of a Phone Number <Leetcode 17, Java>
Questioniven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.
2015-09-12 03:35:46
451
原创 【小熊刷题】3Sum Closest <Leetcode 16, Java>
QuestionGiven an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers.
2015-09-12 02:56:59
375
原创 【小熊刷题】3 Sum <Leetcode 15,Java>
QuestionGiven an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
2015-09-11 23:24:26
391
1
原创 【小熊刷题】Longest Common Prefix <Leetcode 14, Java>
QuestionWrite a function to find the longest common prefix string amongst an array of strings.
2015-09-11 09:53:26
424
原创 【小熊刷题】Container with Most Water <Leetcode 11, Java>
QuestionGiven n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0)...
2015-09-11 09:49:53
535
原创 【小熊刷题】ZigZag Conversion <Leetcode 6, Java>
QuestionThe string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows return read row by row.
2015-09-11 03:29:30
463
原创 【小熊刷题】Reverse Linked List <Leetcode 206, Java>
QuestionReverse a singly linked list.
2015-09-10 07:19:05
293
原创 【小熊刷题】Binary Search Tree Iteration <Leetcode 179, Java>
QuestionImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.
2015-09-10 06:26:08
285
原创 【小熊刷题】Binary Tree Right Side View <Leetcode 199, Java>
QuestionGiven 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.
2015-09-09 05:34:53
313
原创 【小熊刷题】power of two, pow(x, n) <Leetcode 231, 50 Java>
Question 1Power of TwoGiven an integer, write a function to determine if it is a power of two. Question2 implement pow(x,n)
2015-09-05 04:02:42
529
原创 【小熊刷题】sqrt(x) <Leetcode 69 Java>
QuestionImplement int sqrt(int x).Compute and return the square root of x.
2015-09-04 10:05:32
364
原创 【小熊刷题】Best Time to Buy and Sell Stock I <leetcode 121 Java>
Say 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 design an algorithm to find the maximum profit.
2015-09-01 23:35:45
364
原创 【小熊刷题】Single Number II
QuestionGiven an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity.
2015-08-27 03:53:08
321
原创 【小熊刷题】Binary Tree Maximum Path Sum
QuestionGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example, given the below binary tree,The highlighted path yields the maximum
2015-08-26 10:33:56
345
原创 【小熊刷题】Convert Sorted List to Balanced Binary Search Tree<可再复习>
QuestionGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
2015-08-26 03:48:36
334
原创 【小熊刷题】Convert Sorted Array to Balanced Binary Search Tree
QuestionGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.
2015-08-26 02:04:25
248
原创 【小熊刷题】Balanced Binary Tree
QuestionGiven a binary tree, determine if it is height-balanced. A height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ more than 1.
2015-08-25 23:37:11
310
原创 【小熊刷题】Minimum Depth of Binary Tree
QuestionGiven 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 leaf node.
2015-08-25 10:52:39
621
原创 【小熊刷题】Maximum Depth of Binary Tree
QuestionGiven 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 node.
2015-08-25 10:09:57
282
原创 【小熊刷题】Validate Binary Search Tree <含recursion>
QuestionGiven a binary tree, determine if it is a valid Binary Search Tree (BST).
2015-08-25 05:49:38
475
原创 【小熊刷题】Copy List with Random Pointer <可再复习思路>
Copy List with Random PointerQuestionA linked list is given such that each node contains an additional random pointer that could point to any node in the list or null.Return a deep copy of the list.
2015-08-20 06:11:46
242
原创 【小熊刷题】Merge K Sorted Linked Lists
QuestionMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
2015-08-20 02:46:49
251
原创 【小熊刷题】Add Two Numbers in Linked Lists
You are given two linked lists representing two non-negative numbers.
2015-08-17 10:20:10
640
原创 【小熊笔记】动态规划相关
昨天看了一道Longest Palindrome Substring的题,书中提到了动态规划(Dynamic Programming, DP)。 想起之前旁听课就一知半解,以前刷题也没有好好刷,于是决定好好学习一下。目前学习的粗浅心得是,DP跟递归有一个共同的技巧就是,不要想太多。都是focus在当前状态,顶多往前往后推一层。先看了知乎两个帖子:http://www.zhihu
2015-08-14 22:08:56
390
原创 【小熊刷题】valid number - 各种edge cases真是醉了
QuestionValidate if a given string is numeric. extreme case: " -.7e+0435"
2015-08-11 10:22:57
537
原创 【小熊刷题】String to Integer (atoi)
Implement atoi to convert a string to an integer.
2015-08-11 03:42:28
282
原创 【小熊刷题】reverse words in a string w. or w/o. allocating extra space
Reverse words in a String with or without extra space allocation
2015-08-10 10:03:27
348
原创 【小熊刷题】implement strstr()
QuestionImplement strstr(). Returns the index of the first occurrence of needle in haystack, or –1 if needle is not part of haystack.
2015-08-10 04:42:32
301
原创 【小熊刷题】valid palindrome
Valid PalindromeQuestion:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
2015-08-07 02:46:35
314
原创 【小熊刷题】Two Sum II - sorted array
Two SumQuestion:Similar to Question [1. Two Sum], except that the input array is already sorted in ascending order.
2015-08-05 23:39:30
296
原创 【小熊刷题】Two Sum <Array/String>
写在前面今天终于下定决心刷题了,先从已有答案的leetcode刷起。写在这里督促自己 :) Two Sum https://leetcode.com/problems/two-sum/ *Difficulty: Easy, Frequency: High
2015-08-05 09:34:34
247
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人