随笔分类 - leetcode_hashTable
摘要:Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng
阅读全文
摘要:Design a data structure that supports all following operations in average O(1) time. 设计一个数据结构,使得插入、删除,随机获取一个元素的时间复杂度都是O(1)
阅读全文
摘要:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the
阅读全文
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr
阅读全文
摘要:题目:给定一个整型数组,返回两个数的下标,满足两个数相加为一个特定整数。假定只有一个正确答案 例如: nums = [2, 7, 11, 15], target = 9,因为nums[0] + nums[1] = 2 + 7 = 9,返回[0,1] 思路:如果是只返回两个数,可以将数组排序后,从两边
阅读全文