- 博客(11)
- 收藏
- 关注
原创 LeetCode 6
6. ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A ...
2018-02-28 18:38:34 136
原创 LeetCode 5
5. Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: "babad"Output: "bab"Note: "aba" is als...
2018-02-27 17:21:56 346
原创 LeetCode 4
4. Median of Two Sorted ArraysThere 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))....
2018-02-26 12:56:25 644 1
原创 LeetCode 3
3. Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length ...
2018-02-24 15:15:34 156
原创 LeetCode 2
2. Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two nu...
2018-02-23 12:58:35 98
原创 LeetCode 7
7.Reverse IntegerInput: 123Output: 321整数溢出后返回0 ,判断整数溢出:当整数溢出时,会得到一个随机的值,除以10,不会得到上一轮的结果;class Solution {public: int reverse(int x) { int ans=0,flag=0; while(x){ flag...
2018-02-22 20:17:54 145
原创 LeetCode Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same el...
2018-02-22 12:22:22 75
原创 PAT 甲级 1002
1002. A+B for Polynomials (25)This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains ...
2018-02-21 23:32:34 764 1
原创 PAT 甲级 1001(20)
1001. A+B Format (20)Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach in...
2018-02-20 15:40:45 100
原创 PAT 乙级1010
1010一元多项式求导(25)设计函数求一元多项式的导数。(注:xn(n为整数)的一阶导数为n*xn-1。)输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是0,但是表示为“0 0”。输入样例:3 4 -5 2 ...
2018-02-20 14:14:25 171
原创 PAT 乙级 1009
1009 说反话(20)给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hello World Here I C...
2018-02-19 22:19:53 202
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人