- 博客(18)
- 资源 (1)
- 收藏
- 关注
原创 leetcode 215. Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.
2016-07-29 12:33:16 388
原创 leetcode 82. Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2->3->3->4->4->5, return 1->2->5.Given 1->1-
2016-07-28 14:56:52 165
原创 leetcode 86. Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of
2016-07-28 13:07:05 273
原创 leetcode 62. Unique Paths
A 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 robot is trying to reach the
2016-07-27 10:06:33 214
原创 leetcode 345. Reverse Vowels of a String
Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede".Note
2016-07-26 14:47:14 206
原创 leetcode 344. Reverse String
Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".第一次使用的是string来做,从后往前遍历输入的string,依次存入新的string中,提交的时候没有通过,因为超时了。超时的方法如下:
2016-07-26 11:55:49 218
原创 leetcode 88. Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold addit
2016-07-25 20:30:56 168
原创 leetcode 83. Remove Duplicates from Sorted List
Given 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->3->3, return 1->2->3. /** * Definition f
2016-07-25 19:37:22 167
原创 leetcode 7. Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before c
2016-07-24 22:50:22 200
原创 leetcode 26. Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
2016-07-22 17:36:39 165
原创 leetcode 20. Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all valid
2016-07-22 17:04:19 165
原创 leetcode 142. Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?
2016-07-22 15:34:04 172
原创 leetcode 367. Valid Perfect Square
Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16Retu
2016-07-22 14:15:49 240
原创 leetcode150 Evaluate Reverse Polish Notation
leetcode150 Evaluate Reverse Polish Notation
2016-07-22 11:17:38 228
原创 Remove Nth Node From End of List leetcode java
[Leetcode19] Remove Nth Node From End of List
2016-07-20 20:14:48 187
原创 Divide Two Integers
int 范围:Integer.MIN_VALUE => -2147483648Integer.MAX_VALUE => 2147483647overflow:当被除数为 Integer.MIN_VALUE的时候,取绝对值或者除以-1都会造成溢出overflow.Math.abs(-2147483648) => -2147483648Intege
2016-07-20 00:27:41 285
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人