LeetCode
文章平均质量分 59
Metsa
这个作者很懒,什么都没留下…
展开
-
1 - 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, where原创 2016-01-22 12:21:21 · 250 阅读 · 0 评论 -
2 - 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原创 2016-01-22 13:44:32 · 191 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
int lengthOfLongestSubstring(string s) { int n = s.size(); if (n <= 1) { return n; } int i = 0;//start of the current checking string int j = 1;//end of the current checking string int len =原创 2016-01-28 15:53:48 · 292 阅读 · 0 评论 -
Longest Palindromic Substring(最长回文子串)
string findLongestPalindrome(string & str){ size_t n = str.size(); size_t max_length = 0; size_t len = 0; size_t start = 0; if(n <= 1){ return str; } for(size_原创 2016-02-02 07:39:04 · 240 阅读 · 0 评论 -
最大盛水量
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). Find two原创 2016-05-10 07:57:11 · 784 阅读 · 0 评论 -
String to Integer
int myAtoi(string str) { double x = 0; bool neg = false; int index = 0; int len = str.size(); bool foundNumber = false; while (index < len ) { //if str start with spaces if (str[index] ==原创 2016-05-12 04:18:16 · 306 阅读 · 0 评论