1.pandas的去重函数drop_duplicates DataFrame.drop_duplicates(subset=None, keep='first', inplace=False) 其中subset参数为用来指定要去重的列,默认是所有列; keep参数有first,last,False三 ...
分类:
其他好文 时间:
2019-09-18 10:47:51
阅读次数:
95
①中文题目 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 n ...
分类:
编程语言 时间:
2019-09-18 00:48:19
阅读次数:
100
1. "82. Remove Duplicates from Sorted List II (Medium)" Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinc ...
分类:
其他好文 时间:
2019-09-17 11:04:42
阅读次数:
87
path sum Given a binary tree and a sum,determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give... ...
分类:
其他好文 时间:
2019-09-14 22:50:59
阅读次数:
113
26. Remove Duplicates from Sorted Array 从已排序的数组中移除重复元素 https://leetcode.com/problems/remove-duplicates-from-sorted-array/ 题目:给定已排序数组nums,移除重复项,使每个元素只出 ...
分类:
编程语言 时间:
2019-09-10 15:03:20
阅读次数:
120
public class RemoveAllAdjacentDuplicatesInString { /* 解法一:栈 */ public String removeDuplicates(String S) { Stack<Character> stack=new Stack<>(); for (c... ...
分类:
其他好文 时间:
2019-09-08 14:13:04
阅读次数:
76
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, ...
分类:
其他好文 时间:
2019-09-01 10:42:11
阅读次数:
87
Question Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following ...
分类:
其他好文 时间:
2019-08-31 01:02:32
阅读次数:
53
j今天刷的题是Leecode第11题,题目要求是: 第二种方法是双指针遍历,,主要的难点在于指针的移动。双指针中,移动较小的那个。耗时6ms,内存消耗45.9MB ...
分类:
其他好文 时间:
2019-08-30 23:09:31
阅读次数:
77
给定一个整数数组a,其中1≤a[i]≤n(n为数组长度),其中有些元素出现两次而其他元素出现一次。找到所有出现两次的元素。你可以不用到任何额外空间并在O(n)时间复杂度内解决这个问题吗?示例:输入:[4,3,2,7,8,2,3,1]输出:[2,3]题意:关键就是把数组中的元素当成是索引来看就行。如果索引处的数字出现过一次,就给-1,因为只会出现两次,如果第二次再出现,那么对应位置的值就会是小于0的
分类:
其他好文 时间:
2019-08-25 20:04:35
阅读次数:
83