leetcode
文章平均质量分 62
moluchase
代码是程序员的朋友,虽然没有热情,但是非常忠实。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
001Two Sum (C)
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原创 2016-01-03 21:29:39 · 397 阅读 · 0 评论 -
021 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. Subscribe to see which companies asked this questio原创 2016-12-04 22:36:02 · 235 阅读 · 0 评论 -
020 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 va原创 2016-12-04 21:55:10 · 235 阅读 · 0 评论 -
019 Remove Nth Node From End of List
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原创 2016-12-04 21:13:50 · 267 阅读 · 0 评论 -
017 Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit st原创 2016-12-03 20:12:53 · 518 阅读 · 0 评论 -
012 Integer to Roman(Java)
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 先是了解罗马数的构成 基本字符 I V X L C D原创 2016-05-09 01:10:09 · 820 阅读 · 0 评论 -
011 Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin原创 2016-05-06 23:46:37 · 291 阅读 · 0 评论 -
010Regular Expression Matching
'.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). The function prototype should be: bool isMatch(c原创 2016-05-06 23:35:26 · 259 阅读 · 0 评论 -
009Palindrome Number (C)
Determine whether an integer is a palindrome. Do this without extra space. 题目要求不要开辟额外的空间 回文数:逆序数和正序数不变,对于越界,如果逆序后越界说明不是回文数 如果没有这个要求我立马会用字符串解决,不过这样的要求倒是学到一种新方法,将数字逆过来进行比较,对于越界的问题,将最高位和最低位比较,不相等就返回fa原创 2016-01-12 18:13:56 · 361 阅读 · 0 评论 -
008String to Integer (atoi) (C)
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca原创 2016-01-10 12:30:46 · 414 阅读 · 0 评论 -
007Reverse Integer (C)
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Here are some good questions to ask before coding. Bonus points for you if you have already thoug原创 2016-01-10 10:33:21 · 295 阅读 · 0 评论 -
006ZigZag Conversion (C)
P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a string and make this conversion given a number of rows: string convert(stri原创 2016-01-09 12:14:05 · 536 阅读 · 0 评论 -
005Longest Palindromic Substring (C)
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. 开始竟然看成最大的逆序子串了 回文原创 2016-01-08 12:07:17 · 378 阅读 · 0 评论 -
004Median of Two Sorted Arrays (C)
There are two sorted arrays nums1 and nums2 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)). double findMedianSortedAr原创 2016-01-07 12:19:21 · 356 阅读 · 0 评论 -
003Longest Substring Without Repeating Characters (C)
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. Fo原创 2016-01-06 16:18:54 · 339 阅读 · 0 评论 -
002Add Two Numbers (C)
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 li原创 2016-01-04 23:37:43 · 306 阅读 · 0 评论 -
022 Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [ "((()))", "(()())", "(())()", "()(())原创 2016-12-07 20:22:09 · 305 阅读 · 0 评论
分享