原地移除元素,返回新长度 javascript const removeDuplicates = nums = { let index = 1; for (let i = 0; i ...
分类:
其他好文 时间:
2019-12-15 10:36:46
阅读次数:
76
Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Input: [0,1,2,4,5,7] Output: ["0->2","4->5","7"] Explana ...
分类:
其他好文 时间:
2019-11-23 09:21:31
阅读次数:
67
DataFrame.drop_duplicates(self, subset=None, keep='first', inplace=False) Return DataFrame with duplicate rows removed, optionally only considering ce ...
分类:
其他好文 时间:
2019-11-22 22:11:05
阅读次数:
83
最近在刷leecode题,记录一下刷题过程,话不多说,上题 198.打家劫舍 你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。 给定一个代表每个房屋存放金额的非负整 ...
分类:
其他好文 时间:
2019-11-16 18:08:22
阅读次数:
74
Algorithm 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 [Remove Duplicates from Sorted Array]( https: ...
分类:
其他好文 时间:
2019-11-10 15:29:41
阅读次数:
73
82. Remove Duplicates from Sorted List II 跳过重复节点,返回head。 class Solution { public ListNode deleteDuplicates(ListNode head) { if(head == null || head.ne ...
分类:
其他好文 时间:
2019-11-04 17:09:45
阅读次数:
79
Leetcode 80. Remove Duplicates from Sorted Array II 这里其实也可以用类似于 Remove Duplicates from Sorted Array 中的解法三的模版,由于这里最多允许两次重复,那么当前的数字 num 只要跟上上个覆盖位置的数字 nu ...
分类:
其他好文 时间:
2019-11-01 22:16:59
阅读次数:
97
217. Contains Duplicate Easy Easy Easy Given an array of integers, find if the array contains any duplicates. Your function should return true if any ...
分类:
其他好文 时间:
2019-10-24 11:48:08
阅读次数:
57
数据去重可以使用duplicated()和drop_duplicates()两个方法。 DataFrame.duplicated(subset = None,keep =‘first’)返回boolean Series表示重复行 参数: subset:列标签或标签序列,可选 仅考虑用于标识重复项的某 ...
分类:
编程语言 时间:
2019-10-23 23:47:20
阅读次数:
175
给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。这道题主要用到思路是:滑动窗口class Solution { /** * @param String $s * @return Integer */ function lengthOfLongestSubstring($s) { $l... ...
分类:
其他好文 时间:
2019-10-23 13:15:53
阅读次数:
146