
oj
年糕鱼
这个作者很懒,什么都没留下…
展开
-
LeetCode Single Number I & II
Single Number Total Accepted: 18499 Total Submissions: 41204My SubmissionsGiven an array of integers, every element appears twice except for one. Find that single one.Note:Your algor原创 2014-04-22 21:28:59 · 628 阅读 · 0 评论 -
LeetCode LRU Cache & Insertion Sort List
LRU Cache Total Accepted: 16727 Total Submissions: 120052My SubmissionsDesign and implement a data structure for Least Recently Used (LRU) cache. It should support the following operatio原创 2014-09-03 08:31:59 · 590 阅读 · 0 评论 -
LeetCode Max Points on a Line & Sort List
Max Points on a Line Total Accepted: 17476 Total Submissions: 159844My SubmissionsGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.原创 2014-09-03 08:43:59 · 631 阅读 · 0 评论 -
LeetCode Palindrome Partitioning
Palindrome Partitioning Total Accepted: 18645 Total Submissions: 71813My SubmissionsGiven a string s, partition s such that every substring of the partition is a palindrome.Return all原创 2014-09-15 08:42:07 · 476 阅读 · 0 评论 -
LeetCode Reverse Words in a String & Evaluate Reverse Polish Notation
class Solution {public: int evalRPN(vector &tokens) { int i = 0; while (i < tokens.size()) { if (isOperator(tokens[i])) { i -= 2; strin原创 2014-08-28 21:17:10 · 490 阅读 · 0 评论 -
LeetCode Search in Rotated Sorted Array
Search in Rotated Sorted Array Total Accepted: 9935 Total Submissions: 35479Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might becom原创 2014-03-16 18:40:09 · 493 阅读 · 0 评论 -
LeetCode N-Queens
N-Queens Total Accepted: 5516 Total Submissions: 21906My SubmissionsThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.原创 2014-03-16 10:03:43 · 604 阅读 · 0 评论 -
LeetCode Maximum Depth of Binary Tree
Maximum Depth of Binary Tree Total Accepted: 11728 Total Submissions: 26761My SubmissionsGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the原创 2014-03-06 21:45:07 · 540 阅读 · 0 评论 -
LeetCode Sqrt(x)
Sqrt(x) Total Accepted: 8672 Total Submissions: 40362My SubmissionsImplement int sqrt(int x).Compute and return the square root of x.二分时,while (l int做乘法时会溢出,虽然答案还是int。原创 2014-03-02 21:09:14 · 572 阅读 · 0 评论 -
LeetCode Valid Number
Valid Number Total Accepted: 4830 Total Submissions: 45426My SubmissionsValidate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => fal原创 2014-04-02 13:38:46 · 1031 阅读 · 0 评论 -
LeetCode Copy List with Random Pointer
Copy List with Random Pointer Total Accepted: 8155 Total Submissions: 37086My SubmissionsA linked list is given such that each node contains an additional random pointer which could poin原创 2014-03-26 14:35:37 · 540 阅读 · 0 评论 -
LeetCode N-Queens II
N-Queens II Total Accepted: 4907 Total Submissions: 16210My SubmissionsFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct原创 2014-03-16 17:33:46 · 558 阅读 · 0 评论 -
LeetCode Remove Element
Remove Element Total Accepted: 9749 Total Submissions: 30209My SubmissionsGiven an array and a value, remove all instances of that value in place and return the new length.The order原创 2014-03-09 19:52:51 · 554 阅读 · 0 评论 -
LeetCode Remove Duplicates from Sorted List
Remove Duplicates from Sorted List Total Accepted: 10312 Total Submissions: 30340My SubmissionsGiven a sorted linked list, delete all duplicates such that each element appear only once.原创 2014-03-06 21:53:31 · 450 阅读 · 0 评论 -
LeetCode Candy
Candy Total Accepted: 6750 Total Submissions: 39626My SubmissionsThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children原创 2014-03-02 22:10:34 · 701 阅读 · 0 评论 -
LeetCode Rotate List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *ro原创 2014-04-22 21:50:00 · 470 阅读 · 0 评论 -
LeetCode Word Break II
Word Break II Total Accepted: 7703 Total Submissions: 50334My SubmissionsGiven a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a val原创 2014-04-27 22:15:44 · 570 阅读 · 0 评论