leetcode
文章平均质量分 70
wbing520
这个作者很懒,什么都没留下…
展开
-
LeetCode Database Problems
[175] Combine Two Tables[176] Second Highest Salary[177] Nth Highest Salary[178] Rank Scores[180] Consecutive Numbers[181] Employees Earning More Than Their Managers[182] Duplica原创 2015-09-16 09:57:59 · 562 阅读 · 0 评论 -
[LeetCode] Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates".原创 2014-11-12 13:50:38 · 411 阅读 · 0 评论 -
[LeetCode] Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum sh原创 2014-11-13 13:59:22 · 1092 阅读 · 0 评论 -
[LeetCode] Reverse Linked List II Solution
Reverse a linked list from position m to n, Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4return 1->4->3->2->5->NULL.Note:Given m, n satisfy the follo原创 2014-10-27 05:35:14 · 618 阅读 · 0 评论 -
[LeetCode 86] Partition List Solution
Gi原创 2014-10-23 13:54:39 · 550 阅读 · 0 评论 -
[LeetCode] Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element原创 2014-11-11 10:55:50 · 427 阅读 · 0 评论 -
[LeetCode] Remove Element
Given an array and a value, remove all instances of that value in place and return the new原创 2014-11-10 11:45:06 · 408 阅读 · 0 评论 -
[LeetCode] 计划和安排 之二
2014-11-9 到 2014-11-15类别:【Two Pointers】https://oj.leetcode.com/tag/two-pointers/[2014-11-9][LeetCode] Valid Palindrome[LeetCode] Remove Element[LeetCode] Merge Sorted Array[2014-11-10]原创 2014-11-10 13:13:15 · 954 阅读 · 0 评论 -
[LeetCode] Merge Sorted Array
Given Two Sorted integer array A and B, merge B into A as one sorted array.Note:You may assume that A has enough space(size that is )原创 2014-11-10 13:02:27 · 437 阅读 · 0 评论 -
[LeetCode] Valid Palindrome
Given a string, determine if it is a palindrome,considering only alphanumeric characters and ignoring cases.原创 2014-11-10 12:34:01 · 425 阅读 · 0 评论 -
[LeetCode] 3Sum Solution
Given 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.NotesElements in a triplet (a, b, c) mu原创 2014-11-16 10:07:38 · 509 阅读 · 0 评论 -
[LeetCode] 4Sum Solution
Given an array S of n integers, are there elements a, b, c and d in原创 2014-11-17 08:21:09 · 536 阅读 · 0 评论 -
[LeetCode] Majority Element solution
Given an array of size n find the majority element.The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element原创 2015-05-22 23:39:18 · 432 阅读 · 0 评论 -
[LeetCode] ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given num原创 2014-11-24 13:32:13 · 431 阅读 · 0 评论 -
[LeetCode] Anagrams solution
Given an array of strings, return all groups of strings that are anagrams.Nots:All in原创 2014-11-25 13:56:13 · 484 阅读 · 0 评论 -
[LeetCode] Linked List Cycle
Given a linked list, deter if it has cycle in it.Follow up: can you solve it without using extra space?原创 2014-11-03 02:31:58 · 495 阅读 · 0 评论 -
[LeetCode] Linked List Cycle II Solution
Given a linked list, return the node where the cycle begins, if there is no cycle, return null.Follow up: could you solve it原创 2014-11-03 07:55:10 · 1069 阅读 · 0 评论 -
[Leetcode] Convert Sorted List to Binary Search Tree Solution
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.原创 2014-11-03 02:02:02 · 685 阅读 · 0 评论 -
[LeetCode] Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"原创 2014-11-18 13:31:50 · 877 阅读 · 0 评论 -
[LeetCode] 3Sum Closest
Given an array of 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. You may assume that each input would have exac原创 2014-11-17 13:50:54 · 635 阅读 · 0 评论 -
【LeetCode】 刷题计划
计划和安排之一(Linked List): http://www.meetqun.com/thread-1749-1-1.html计划和安排之二 (Two Pointers):http://meetqun.com/thread-1942-1-1.html 这个为计划和安排之三 (string) 共计33题:https://oj.leetcode.com/tag/string/原创 2014-11-17 14:32:05 · 1211 阅读 · 0 评论 -
[LeetCode 143] Reorder List Solution
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder原创 2014-10-07 07:25:57 · 1135 阅读 · 0 评论 -
[LeetCode] Reverse Nodes in K-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modi原创 2014-11-09 16:20:15 · 520 阅读 · 0 评论 -
[LeetCode 36] Valid Sudoku Solution
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially fille原创 2014-04-20 04:34:28 · 1030 阅读 · 0 评论 -
[LeetCode 21] Merge Two Sorted Lists Solution
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *me原创 2014-04-19 01:40:28 · 621 阅读 · 0 评论 -
[LeetCode 20] Valid Parentheses Solution
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 va原创 2014-04-19 01:01:04 · 675 阅读 · 0 评论 -
[LeetCode 35] Search Insert Position Solution
Given 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 may assume no duplicates in the array.原创 2014-04-19 02:35:50 · 647 阅读 · 0 评论 -
[LeetCode 19] Remove Nth Node From End of List Solutions
Given 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原创 2014-04-18 08:31:29 · 650 阅读 · 0 评论 -
[LeetCode 12] Integer to Roman
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Ideas: based on the roman and integer relationship.原创 2014-04-17 13:28:01 · 488 阅读 · 0 评论 -
[LeetCode 14] Longest Common Prefix Solutions
Write a function to find the longest common prefix string amongst an array of strings.原创 2014-04-17 12:48:10 · 452 阅读 · 0 评论 -
[LeetCoce 13] Roman to Integer 罗马数字转化为数字
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Note: I got this pr原创 2014-04-14 09:21:18 · 838 阅读 · 0 评论 -
[LeetCode 9] Palindrome Number -- 回文数字
Determine whether an integer is a palindrome. Do this without extra space.First of all:原创 2014-04-14 01:08:06 · 762 阅读 · 0 评论 -
[LeetCode 1] Two Sum solution
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2014-04-10 13:45:42 · 701 阅读 · 0 评论 -
[LeetCode 65] Valid Number Solution
Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo原创 2014-05-19 13:41:48 · 911 阅读 · 0 评论 -
[LeetCode Solution] Merge k sorted Lists
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *me原创 2014-11-09 15:33:40 · 511 阅读 · 0 评论 -
【LeetCode】Linked List 类题目列表
本帖最后由 wbing520 于 11-2-2014 10:03 PM 编辑既然我们成立了小组(【2014刷题组】),明确了目标 (2015年1月1日前完成 leetcode). 我们就要有计划,有安排,最终实现我们的目标。LeetCode:共154题时间: 11.2 to 12. 31 共计 29 + 31 = 60 天平均154/60 = 2 到 3题。(看原创 2014-11-09 16:34:12 · 716 阅读 · 0 评论 -
[LeetCode] Copy List with Random Pointer
A linked list is given such that each node contains an additional random po原创 2014-11-08 17:37:33 · 562 阅读 · 0 评论 -
[LeetCode 148] Insertion Sort List
Sort a linked list using insertion sort.原创 2014-08-16 04:50:55 · 572 阅读 · 0 评论 -
[LeetCode 148] Sort List Solution
Sort a linked list in O(n log n) time using constant space complexity.原创 2014-08-15 13:09:36 · 1121 阅读 · 0 评论 -
[Leecode 61] 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.Idea: get the length of原创 2014-06-01 22:12:37 · 597 阅读 · 0 评论