上一页 1 ··· 5 6 7 8 9 10 11 12 下一页
摘要: Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1 vs1 = split(version1, '.'); vector vs2 = split(version2,... 阅读全文
posted @ 2015-10-24 09:32 AprilCheny 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
posted @ 2015-10-23 11:06 AprilCheny 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".解法:从后往前对两个string相加即可。注意将char转换为int,注意进位,注意结果顺序。... 阅读全文
posted @ 2015-10-23 10:09 AprilCheny 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
posted @ 2015-10-22 11:31 AprilCheny 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Write a function to find the longest common prefix string amongst an array of strings.解法:从所有的string的头到尾的字母逐一比较即可。class Solution {public: string lon... 阅读全文
posted @ 2015-10-22 11:27 AprilCheny 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
posted @ 2015-10-17 20:48 AprilCheny 阅读(185) 评论(0) 推荐(0) 编辑
摘要: [LeetCode]1. 2Sum题目:https://leetcode.com/problems/two-sum/,解答:http://www.cnblogs.com/aprilcheny/p/4823576.html;[LeetCode]2. 3Sum题目:https://leetcode.co... 阅读全文
posted @ 2015-10-17 20:20 AprilCheny 阅读(253) 评论(0) 推荐(0) 编辑
摘要: Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2015-10-17 19:57 AprilCheny 阅读(276) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2015-10-16 11:19 AprilCheny 阅读(222) 评论(0) 推荐(0) 编辑
摘要: You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?解法1:新开辟一个矩阵,空间复杂度O(... 阅读全文
posted @ 2015-10-15 17:25 AprilCheny 阅读(140) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 下一页