码迷,mamicode.com
首页 >  
搜索关键字:leecode duplicates    ( 1908个结果
leecode 17. 电话号码的字母组合
给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 示例: 说明:尽管上面的答案是按字典序排列的,但是你可以任意选择答案输出的顺序。 分析 : 回溯法,通过了,效率不高 ...
分类:其他好文   时间:2018-07-27 01:10:53    阅读次数:233
leecode 3. 无重复字符的最长子串
给定一个字符串,找出不含有重复字符的最长子串的长度。 示例: 给定 "abcabcbb" ,没有重复字符的最长子串是 "abc" ,那么长度就是3。 给定 "bbbbb" ,最长的子串就是 "b" ,长度是1。 给定 "pwwkew" ,最长子串是 "wke" ,长度是3。请注意答案必须是一个子串, ...
分类:其他好文   时间:2018-07-25 01:07:16    阅读次数:158
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 spa ...
分类:其他好文   时间:2018-07-22 20:48:58    阅读次数:143
LeetCode 448. Find All Numbers Disappeared in an Array & 442. Find All Duplicates in an Array
这两道题很有意思,由于元素为1~n,因此每个元素的值-1(映射到0~n-1)就可以直接当做下标。这样将 nums 中对应下标的元素 *-1 以i表示 index+1 这个元素出现过了,能节省存储的空间。 448. Find All Numbers Disappeared in an Array 44 ...
分类:移动开发   时间:2018-07-18 17:18:07    阅读次数:187
LeeTCode题解之Remove Duplicates from Sorted List
1、题目描述 2、问题分析 对于链表中的每一个元素,找到其后面和它不相等的第一个元素,然后指向该元素。 3、代码 ...
分类:其他好文   时间:2018-07-17 14:26:43    阅读次数:127
C++ pair用法
刷leecode有这么一道题: 给定两个大小相等的数组 A 和 B,A 相对于 B 的优势可以用满足 A[i] > B[i] 的索引 i 的数目来描述。 返回 A 的任意排列,使其相对于 B 的优势最大化。 我第一次想的是枚举法,然后超时了。 后来想了想。换了一种方法做。通过用例了。 1.首先两个数 ...
分类:编程语言   时间:2018-07-16 14:12:17    阅读次数:155
LeetCode题解之Find All Duplicates in an Array
1、题目描述 2、问题分析 将数组中的元素 A[i] 放到 A[ A[i] - 1] 的位置。然后遍历一边数组,如果不满足 A[i] == i+1,则将A[i]添加到 结果中。 3、代码 ...
分类:其他好文   时间:2018-07-14 20:37:31    阅读次数:193
[leetcode] Next Greater Element
今天处理一下一系列题目:Next Greater Element系列。 Next Greater Element I You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are su ...
分类:其他好文   时间:2018-07-13 23:43:36    阅读次数:194
LeeCode from 0 —— 69. Sqrt(x)
69. Sqrt(x) Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return t ...
分类:其他好文   时间:2018-07-12 22:39:48    阅读次数:152
LeeCode from 0 —— 67. Add Binary
67. Add Binary Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1  ...
分类:其他好文   时间:2018-07-12 21:49:15    阅读次数:132
1908条   上一页 1 ... 27 28 29 30 31 ... 191 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!