LeetCode
荒原Plus
这个世界很大
展开
-
leetcode 66. Plus One 加一运算
今天本来想做三道题目,无奈拖延症效率太低。。。Description: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 th...原创 2018-11-23 21:32:08 · 674 阅读 · 0 评论 -
leetcode 26. Remove Duplicates from Sorted Array 移除数组中的重复元素
今日份leetcode 26. Remove Duplicates from Sorted ArrayDescription:Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not ...原创 2018-11-28 15:03:14 · 120 阅读 · 0 评论 -
leetcode 121. Best Time to Buy and Sell Stock
Description:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of...原创 2018-11-28 11:14:44 · 200 阅读 · 0 评论 -
leetcode 11. Container With Most Water
因为一些事情已经有两天没刷leetcode了,从今天开始加油!一切都会慢慢变好的。今日份leetcode 11. Container With Most WaterDescription:Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n...原创 2018-12-02 18:46:08 · 342 阅读 · 0 评论 -
leetcode 27. Remove Element
昨天偷了个懒没有刷leetcode题目。懊悔不已。。。今日份leetcode 27. Remove ElementDescription:Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate e...原创 2018-11-27 11:12:34 · 133 阅读 · 0 评论 -
leetcode 88. Merge Sorted Array 合并有序数组
今日份leetcode 88. Merge Sorted ArrayDescription:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:The number of elements initialized in nums1 and nums...原创 2018-11-29 23:34:06 · 167 阅读 · 0 评论 -
leetcode 189. Rotate Array
今日份leetcode 189. Rotate ArrayDescription:Given an array, rotate the array to the right by k steps, where k is non-negative.Example 1:Input: [1,2,3,4,5,6,7] and k = 3Output: [5,6,7,1,2,3,4]Expl...原创 2018-11-25 13:11:39 · 129 阅读 · 0 评论 -
leetcode 167. Two Sum II - Input array is sorted
这是今天的第二道题目,本来计划好的做三道,终究还是效率低。。。Description:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoS...原创 2018-11-24 23:56:34 · 110 阅读 · 0 评论 -
leetcode 119. Pascal's Triangle II 杨辉三角2
Description:Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal’s triangle.Note that the row index starts from 0.In Pascal’s triangle, each number is the sum of the t...原创 2018-11-24 21:42:57 · 113 阅读 · 0 评论 -
leetcode 283. Move Zeroes
283.Move ZeroesDescription:Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.Example:Input: [0,1,0,3,12]Output: ...原创 2018-11-25 22:37:23 · 124 阅读 · 0 评论 -
leetcode首题! 35. Search Insert Position 搜索插入位置
今天是第一次刷leetcode的题目,刚开始接触有些困难。从今天开始每天至少一题(有时间就写笔记)。希望坚持下去,加油!版本一class Solution { public int searchInsert(int[] nums, int target) { int flag=-1; if(nums.length==1){ if(...原创 2018-11-22 23:40:48 · 112 阅读 · 0 评论 -
leetcode 16. 3Sum Closest
今日份LeetCode 16. 3Sum ClosestDescription:Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three in...原创 2018-12-03 18:20:40 · 128 阅读 · 0 评论