![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
每天必发微博的好学生
码农
展开
-
我的LeetCode第一弹 Leetcode: Two Sum
vector TwoSum(vector &numbers,int target){ int length=numbers.size(); vectorvec; if(length<2) return vec; std::multimap mp; multimap::iterator iter=mp.end(); multimap::iterator iter2=mp.原创 2014-05-17 15:57:50 · 384 阅读 · 0 评论 -
LeetCode : Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.原创 2014-05-21 17:48:50 · 315 阅读 · 0 评论 -
LeetCode :Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.原创 2014-05-21 18:00:18 · 295 阅读 · 0 评论 -
LeetCode : Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.原创 2014-05-21 17:42:24 · 326 阅读 · 0 评论 -
LeetCode : Sort List
Sort a linked list in O(n log n) time using constant space complexity.原创 2014-05-21 17:43:45 · 273 阅读 · 0 评论 -
LeetCode : Binary Tree Postorder Traversal
vector postorderTraversal(TreeNode *root) { vector vec; vector vecResult; TreeNode *pointer=root; Node *pointer=getRoot(),*pre=NULL; while (pointer) { while (pointer->le原创 2014-05-21 18:07:02 · 316 阅读 · 0 评论 -
LeetCode :Insertion Sort List
Sort a linked list using insertion sort.原创 2014-05-21 17:39:57 · 310 阅读 · 0 评论 -
LeetCode: Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).转载 2014-05-18 11:26:00 · 296 阅读 · 0 评论 -
LeetCode:Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For原创 2014-05-18 11:22:56 · 314 阅读 · 0 评论 -
LeetCode:Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.原创 2014-05-18 11:21:25 · 262 阅读 · 0 评论 -
LeetCode:Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link原创 2014-05-18 14:01:35 · 284 阅读 · 0 评论 -
LeetCode : Binary Tree Preorder Traversal
vector preorderTraversal(TreeNode *root) { vector vec; vector vecResult; TreeNode *pointer=root; while(pointer||vec.empty()){ if(pointer){原创 2014-05-21 18:01:56 · 301 阅读 · 0 评论