- 博客(8)
- 收藏
- 关注
原创 Leetcode#19 Remove Nth Node From End of List
Difficulty: easyGiven 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
2015-06-26 01:28:03 241
原创 Leetcode#1 Two Sum
Difficulty: MediumGiven 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
2015-06-26 00:03:44 246
原创 Leetcode#14 Longest Common Prefix
很简答的一题,因为我if(strs.size()==0) return "";和 string prefix; prefix = strs[0];的顺序写翻了runtimerror了一个小时,醉了。。。string longestCommonPrefix(vector& strs) { if(strs.size()=
2015-06-25 01:42:27 289
原创 Leetcode#6 ZigZag Conversion
Difficulty EasyThe 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)
2015-06-24 22:13:36 259
原创 Leetcode#7 Reverse Integer !!!Update (2014-11-10)之后的版本!!!
去年11月份的更新导致CSDN博客里老的题解都是错的。其实很简单,用long long 考虑下是否溢出,本人愚笨,用最土的方法,不过至少在两CE,两次WA之后AC了,开森~!题目:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321
2015-06-24 00:49:43 187
原创 Leetcode#9 Palindrome Number(两种方法)
Difficulty:Easyclass Solution {public: bool isPalindrome(int x) { int left,right; if(x<0) return false; if(x==0) return true; int k = 1, flag =
2015-06-23 00:25:33 281
原创 Leetcode#12 Integer to Roman
Difficulty: Medium这个暑假做的第一个中等题,思路和#13一样的,一点都不难,但是在string处理上花了点时间,收获不少。#include #include #include using namespace std;string toString(int a, int b){ string s; char c1,c2,c3;
2015-06-22 15:15:41 256
原创 Leetcode#13:romanToInt 暑假训练第一弹
长时间未没有练习,生疏了太多。语言不够简洁,慢慢来吧Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.#include #include #include using namespace std;
2015-06-22 03:39:56 380
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人