LeetCode #18 – 4Sum [双指针]


链接:https://leetcode.com/problems/4sum/ 题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a ...

LeetCode #18 – 4Sum [双指针]

链接:https://leetcode.com/problems/4sum/ 题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = t...
阅读全文 0

LeetCode #16 – 3Sum Closest [数组 双指针]


链接:https://leetcode.com/problems/3sum-closest/ 题目:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would hav...

LeetCode #16 – 3Sum Closest [数组 双指针]

链接:https://leetcode.com/problems/3sum-closest/ 题目:Given an array S of n integers, find three integers in S such that the sum is closest to a ...
阅读全文 0

LeetCode #15 – 3Sum


链接:https://leetcode.com/problems/3sum/ 题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must ...

LeetCode #15 – 3Sum

链接:https://leetcode.com/problems/3sum/ 题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all ...
阅读全文 0

HDU 1165 – Eddy’s research II [推公式]


vjudge题目连接 Description As is known, Ackermann function plays an important role in the sphere of theoretical computer science. However, in the other hand, the dramatic fast increasing pace of the function caused the value of Ackermann functio...

HDU 1165 – Eddy’s research II [推公式]

vjudge题目连接 Description As is known, Ackermann function plays an important role in the sphere of theoretical computer science. However, in the...
阅读全文 0

LeetCode #14 – Longest Common Prefix


链接:https://leetcode.com/problems/longest-common-prefix/ 题目:Write a function to find the longest common prefix string amongst an array of strings. 题意:给定一些字符串,找出最常公共前缀 分析:直接暴力做就可以,最常前缀的长度不长于最短的字符串...

LeetCode #14 – Longest Common Prefix

链接:https://leetcode.com/problems/longest-common-prefix/ 题目:Write a function to find the longest common prefix string amongst an array of stri...
阅读全文 0

LeetCode #13 – Roman to Integer


LeetCode题目链接 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题意:给定一个罗马数字字符串,将他转化为阿拉伯整数。 class Solution: def romanToInt(self, s): dict = {'I':...

LeetCode #13 – Roman to Integer

LeetCode题目链接 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 题意:给定一个罗马数字...
阅读全文 0

LeetCode #12 – Integer to Roman


LeetCode题目链接 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题意:给定阿拉伯数字,转化为罗马数字 打表记录可能出现的罗马数字,从高位开始处理。 class Solution: def intToRoman(s...
LeetCode题目链接 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题意:给定阿拉伯数字,转化为罗马数字 打表记录可能出...

LeetCode #12 – Integer to Roman

LeetCode题目链接 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题意:给定阿拉伯数字,...
阅读全文 0

LeetCode #11 – Container With Most Water


LeetCode题目链接 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 lines, which together with...

LeetCode #11 – Container With Most Water

LeetCode题目链接 Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn...
阅读全文 0

LeetCode #9 – Palindrome Number


LeetCode题目链接 Determine whether an integer is a palindrome. Do this without extra space. Some hints:Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, note the restriction of using extra sp...

LeetCode #9 – Palindrome Number

LeetCode题目链接 Determine whether an integer is a palindrome. Do this without extra space. Some hints:Could negative integers be palindromes? (ie,...
阅读全文 0

LeetCode #8 – String to Integer (atoi) [正则表达式]


LeetCode题目链接 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 cases. Notes: It is intended for th...

LeetCode #8 – String to Integer (atoi) [正则表达式]

LeetCode题目链接 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, plea...
阅读全文 0