leetcode_arr_easy
zerlina98
这个作者很懒,什么都没留下…
展开
-
【Leetcode】1. Two Sum
//题目要求Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the s...原创 2018-04-01 21:31:05 · 96 阅读 · 0 评论 -
【Leetcode】26 Remove Duplicates from Sorted Array
//题目Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modif...原创 2018-04-01 21:35:48 · 89 阅读 · 0 评论 -
【Leetcode】27 Remove Element
//题目:Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input a...原创 2018-04-01 21:42:08 · 102 阅读 · 0 评论 -
【Leetcode】35. Search Insert Position
题目Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.给定...原创 2018-04-01 21:51:06 · 80 阅读 · 0 评论 -
【Leetcode】66. Plus One
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element i...原创 2018-04-30 17:57:16 · 153 阅读 · 0 评论 -
【Leetcode】53. Maximum Subarray
题目:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.找到拥有最大的和的连续的子数组//也可以用smax = max(smax,sum);class Solution { p...原创 2018-04-01 21:54:46 · 109 阅读 · 0 评论 -
【Leetcode】2.reverse-integer
题目Given a 32-bit signed integer, reverse digits of an integer.32-bit很大,所以要按位来//调试,可以设置断点,可以单步调试,看究竟是哪里出错//要看代码逻辑,什么变量究竟是什么值#include <iostream>using namespace std;class Solution{public: i...原创 2018-04-01 21:33:04 · 155 阅读 · 0 评论