LintCode学习之数组
文章平均质量分 61
zy300212
这个作者很懒,什么都没留下…
展开
-
x的平方根——(不知为何这道有点难)
class Solution {public: /** * @param x: An integer * @return: The sqrt of x */ int sqrt(int x) { // write your code here if(x ==1 && x == 0){return x;}原创 2016-01-23 23:54:23 · 534 阅读 · 0 评论 -
合并区间
/** * Definition of Interval: * classs Interval { * int start, end; * Interval(int start, int end) { * this->start = start; * this->end = end; * } */class Solution原创 2016-03-06 15:35:40 · 237 阅读 · 0 评论 -
最大子数组
class Solution {public: /** * @param nums: A list of integers * @return: A integer indicate the sum of max subarray */ int maxSubArray(vector nums) { // write your原创 2016-01-24 01:16:16 · 306 阅读 · 0 评论 -
删除排序数组中的重复数字
class Solution {public: /** * @param A: a list of integers * @return : return an integer */ int removeDuplicates(vector &nums) { // write your code here if(nums原创 2016-03-08 10:09:46 · 335 阅读 · 0 评论 -
恢复旋转排序数组
难!class Solution {public: int getGCD(int a, int b) { if (a % b == 0) { return b; } return getGCD(b, a % b); } void recoverRotatedSortedArray(原创 2016-03-08 17:22:59 · 258 阅读 · 0 评论 -
判断字符串是否没有重复字符
class Solution {public: /** * @param str: a string * @return: a boolean */ bool isUnique(string &str) { // write your code here int ch[128] = {0}; for (原创 2016-03-09 12:23:33 · 336 阅读 · 0 评论 -
不同的路径
class Solution {public: /** * @param n, m: positive integer (1 <= n ,m <= 100) * @return an integer */ int uniquePaths(int m, int n) { // wirte your code here v原创 2016-03-09 12:36:11 · 265 阅读 · 0 评论