
Leetcode
CodingAsura
知其然,知其所以然
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Add Two Numbers
Add Two Numbers Total Accepted: 52318 Total Submissions: 235849My Submissions/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNo原创 2015-04-06 20:36:40 · 275 阅读 · 0 评论 -
Integer to Roman
Integer to Roman Total Accepted: 41179 Total Submissions: 120292My SubmissionsQuestion Solution Given an integer, convert it to a roman numeral.Input is guaranteed to be within原创 2015-09-04 18:42:53 · 359 阅读 · 0 评论 -
Roman to Integer
Roman to Integer Total Accepted: 50788 Total Submissions: 147615My SubmissionsQuestion Solution Given a roman numeral, convert it to an integer.Input is guaranteed to be within原创 2015-09-04 19:33:39 · 311 阅读 · 0 评论 -
4Sum
4Sum Total Accepted: 45840 Total Submissions: 210663My SubmissionsQuestion Solution Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c +原创 2015-09-05 12:30:41 · 294 阅读 · 0 评论 -
3Sum Closest
3Sum Closest Total Accepted: 49672 Total Submissions: 184745My SubmissionsQuestion Solution Given an array S of n integers, find three integers in S such that the sum is closest原创 2015-09-05 11:49:31 · 297 阅读 · 0 评论 -
Remove Nth Node From End of List
class Solution {public: ListNode* removeNthFromEnd(ListNode* head, int n) { if( n <= 0) return NULL; ListNode *First = head, *Second = head; int i = 0; for( ; i < n; i ++) {原创 2015-09-07 23:00:49 · 265 阅读 · 0 评论 -
Generate Parentheses
Generate ParenthesesMy SubmissionsQuestion Solution Total Accepted: 57885 Total Submissions: 176392 Difficulty: MediumGiven n pairs of parentheses, write a function to ge原创 2015-09-12 22:37:44 · 385 阅读 · 0 评论 -
Swap Nodes in Pairs
Swap Nodes in PairsMy SubmissionsQuestion Solution Total Accepted: 62382 Total Submissions: 192595 Difficulty: MediumGiven a linked list, swap every two adjacent nodes and re原创 2015-09-13 16:42:47 · 325 阅读 · 0 评论 -
Merge k Sorted Lists
Merge k Sorted ListsMy SubmissionsQuestion Solution Total Accepted: 55947 Total Submissions: 265405 Difficulty: HardMerge k sorted linked lists and return it as one sorted li原创 2015-09-13 19:19:03 · 322 阅读 · 0 评论 -
Reverse Nodes in k-Group
Reverse Nodes in k-GroupMy SubmissionsQuestion Solution Total Accepted: 41856 Total Submissions: 165382 Difficulty: HardGiven a linked list, reverse the nodes of a linked原创 2015-09-15 10:38:08 · 301 阅读 · 0 评论 -
3Sum
3Sum Total Accepted: 72528 Total Submissions: 429905My SubmissionsQuestion Solution Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Fin原创 2015-09-04 23:32:32 · 381 阅读 · 0 评论 -
Container With Most Water
Container With Most Water Total Accepted: 50362 Total Submissions: 158080My SubmissionsQuestion Solution Given n non-negative integers a1, a2, ..., an, where each represents a原创 2015-09-04 18:01:38 · 419 阅读 · 0 评论 -
Two Sum
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原创 2015-04-06 10:51:52 · 378 阅读 · 0 评论 -
Median of Two Sorted Arrays
Median of Two Sorted Arrays Total Accepted: 44236 Total Submissions: 247850There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overa原创 2015-04-08 23:44:24 · 309 阅读 · 0 评论 -
Longest Palindromic SubstringTotal
Longest Palindromic SubstringTotal Accepted: 65785 Total Submissions: 318428 My Submissions Given a string S, find the longest palindromic substring in S. You may assume that the maximum原创 2015-08-29 17:56:29 · 263 阅读 · 0 评论 -
Palindrome Number
Palindrome Number Total Accepted: 77169 Total Submissions: 270157My SubmissionsQuestion Solution Determine whether an integer is a palindrome. Do this without extra space.click原创 2015-09-01 23:00:57 · 215 阅读 · 0 评论 -
String to Integer (atoi)
String to Integer (atoi) Total Accepted: 63122 Total Submissions: 494040My SubmissionsQuestion Solution Implement atoi to convert a string to an integer.Hint: Carefully conside原创 2015-09-01 23:02:04 · 280 阅读 · 0 评论 -
Reverse Integer
Reverse Integer Total Accepted: 92759 Total Submissions: 391368My SubmissionsQuestion Solution Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, r原创 2015-08-31 23:36:48 · 236 阅读 · 0 评论 -
Letter Combinations of a Phone Number
Letter Combinations of a Phone Number Total Accepted: 51210 Total Submissions: 200367My SubmissionsQuestion Solution Given a digit string, return all possible letter combinations原创 2015-09-08 00:10:21 · 349 阅读 · 0 评论 -
Regular Expression Matching
Regular Expression Matching Total Accepted: 53358 Total Submissions: 258833My SubmissionsQuestion Solution Implement regular expression matching with support for '.' and '*'.'.原创 2015-09-04 14:11:40 · 253 阅读 · 0 评论 -
Valid Parentheses
class Solution {public: bool isValid(string s) { int len = s.length(); if( len & 1 || !len) return false; stack sta; for(int i = 0; i < len; i ++) { if( s[i] == '(' || s[i] == '{'原创 2015-09-09 23:21:34 · 306 阅读 · 0 评论 -
一段c++输入格式解析代码
一段c++输入格式解析代码思路建立两个二维数组存隐射关系,用一个递归函数判断有无锁,懒得写了int main(int argv,char**argc){int num;string input,item, temp;vector wait_id;map haveId_thrId;cin >> num;bool flag = false;i原创 2015-09-21 12:43:43 · 493 阅读 · 0 评论