最新 最热

Leetcode打卡 | No.012 整数转罗马数字

欢迎和小詹一起定期刷leetcode,每周一和周五更新一题,每一题都吃透,欢迎一题多解,寻找最优解!这个记录帖哪怕只有一个读者,小詹也会坚持刷下去的!...

2018-07-24
1

Leetcode打卡 | No.009 回文数

欢迎和小詹一起定期刷leetcode,每周一和周五更新一题,每一题都吃透,欢迎一题多解,寻找最优解!这个记录帖哪怕只有一个读者,小詹也会坚持刷下去的!...

2018-07-24
1

leetCode刷题(找出数组里的两项相加等于定值)

最近被算法虐了一下,刷一下leetcode,找找存在感如题:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that ea......

2018-06-14
1

leetcode 28 Implement strStr()

class Solution {public: int strStr(string haystack, string needle) { if (needle.empty()) return 0; int m = haystack.size(), n = needle.size...

2018-06-04
1

leetcode 16 3Sum Closest

class Solution {public: int threeSumClosest(vector<int>& nums, int target) { int closest = nums[0] + nums[1] + nums[2]; int diff = abs(clos...

2018-06-04
1

leetcode 18 4Sum

class Solution {public: vector<vector<int> > fourSum(vector<int> &nums, int target) { set<vector<int> > res; sort(nums.begin(), nums.end())...

2018-06-04
1

leetcode 6 ZigZag Converesion

class Solution {public: string convert(string s, int nRows) { if (nRows <= 1) return s; string res = ""; int size = 2 * nRows - 2;...

2018-06-04
1

leetcode 7 Reverse Integer

class Solution {public: int reverse(int x) { int res = 0; while (x != 0) { int t = res * 10 + x % 10; if (t / 10 !=...

2018-06-04
1

leetcode 8 String to Integer

public class Solution { public int myAtoi(String str) { if (str.isEmpty()) return 0; int sign = 1, base = 0, i = 0, n = str.length(); ...

2018-06-04
1

leetcode 12 Integer to Roman

class Solution {public: string intToRoman(int num) { string res = ""; vector<int> val{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}...

2018-06-04
1