哈希表
码不停Ti
信息安全在校大学生
展开
-
剑指 Offer 03. 数组中重复的数字
找出数组中重复的数字。在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。示例 1:输入:[2, 3, 1, 0, 2, 5, 3]输出:2 或 3来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof著作权归领扣网络所有。商业转.原创 2020-08-30 17:31:17 · 399 阅读 · 0 评论 -
【LeetCode】设计哈希集合 哈希表探索
不使用任何内建的哈希表库设计一个哈希集合具体地说,你的设计应该包含以下的功能add(value):向哈希集合中插入一个值。 contains(value):返回哈希集合中是否存在这个值。 remove(value):将给定值从哈希集合中删除。如果哈希集合中没有这个值,什么也不做。示例:MyHashSet hashSet = new MyHashSet();hashSet.a...原创 2019-12-14 21:36:26 · 409 阅读 · 0 评论 -
【LeetCode】49. Group Anagrams
Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]Note:All inputs will b...原创 2019-12-10 11:40:44 · 345 阅读 · 0 评论 -
【Leet Code】1. Two Sum
1. Two SumGiven an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not u...原创 2019-09-25 21:52:16 · 395 阅读 · 0 评论 -
【Leet Code】3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3Explanation: The answer is "abc", with the length of 3.Example 2:In...原创 2019-09-27 00:41:35 · 369 阅读 · 0 评论 -
【LeetCode】136. Single Number
Given a non-emptyarray of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without us...原创 2019-10-04 20:44:24 · 361 阅读 · 0 评论