随笔分类 - leetcode_array
leetcode中array类型题目解法
摘要:Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you
阅读全文
摘要:给定一个有序数组,原地删除重复元素,使得每个元素只出现一次,并返回新的长度。不为另一个数组分配额外空间,必须用常量内存做到这一点。
阅读全文
摘要:题目:给定一个整型数组,返回两个数的下标,满足两个数相加为一个特定整数。假定只有一个正确答案 例如: nums = [2, 7, 11, 15], target = 9,因为nums[0] + nums[1] = 2 + 7 = 9,返回[0,1] 思路:如果是只返回两个数,可以将数组排序后,从两边
阅读全文