随笔分类 -  Hash

摘要:1348. Tweet Counts Per Frequency Medium 130231Add to ListShare A social media company is trying to monitor activity on their site by analyzing the num 阅读全文
posted @ 2022-10-04 09:51 苗妙苗 阅读(70) 评论(0) 推荐(0)
摘要:Design and implement a data structure for a Least Frequently Used (LFU) cache. Implement the LFUCache class: LFUCache(int capacity) Initializes the ob 阅读全文
posted @ 2021-08-31 07:39 苗妙苗 阅读(34) 评论(0) 推荐(0)
摘要:Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character '#'). You are 阅读全文
posted @ 2021-08-30 03:40 苗妙苗 阅读(29) 评论(0) 推荐(0)
摘要:You have a queue of integers, you need to retrieve the first unique integer in the queue. Implement the FirstUnique class: FirstUnique(int[] nums) Ini 阅读全文
posted @ 2021-08-29 07:48 苗妙苗 阅读(69) 评论(0) 推荐(0)
摘要:You are given two string arrays username and website and an integer array timestamp. All the given arrays are of the same length and the tuple [userna 阅读全文
posted @ 2021-08-29 02:55 苗妙苗 阅读(52) 评论(0) 推荐(0)
摘要:[抄题]: Given n processes, each process has a unique PID (process id) and its PPID (parent process id). Each process only has one parent process, but ma 阅读全文
posted @ 2018-08-22 11:33 苗妙苗 阅读(182) 评论(0) 推荐(0)
摘要:[抄题]: Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: A partially filled sudoku 阅读全文
posted @ 2018-08-02 16:54 苗妙苗 阅读(213) 评论(0) 推荐(0)
摘要:[抄题]: public MyHashMap() { 主函数里面是装非final变量的,如果没有,可以一个字都不写 } [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: put: 不论如何都要放。所以如果没有bucke 阅读全文
posted @ 2018-07-29 18:12 苗妙苗 阅读(551) 评论(0) 推荐(0)
摘要:[抄题]: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes usef 阅读全文
posted @ 2018-07-26 18:21 苗妙苗 阅读(230) 评论(0) 推荐(0)
摘要:[抄题]: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Example 1: Example 2: [暴力解法]: 时间分析: 空间分析: [优 阅读全文
posted @ 2018-07-25 23:40 苗妙苗 阅读(154) 评论(0) 推荐(0)
摘要:[抄题]: Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT friend reques 阅读全文
posted @ 2018-05-17 10:38 苗妙苗 阅读(308) 评论(0) 推荐(0)
摘要:[抄题]: There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different wid 阅读全文
posted @ 2018-05-16 16:59 苗妙苗 阅读(149) 评论(0) 推荐(0)
摘要:[抄题]: Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Example 2: [暴力解法]: 时间分析: 空间分析: [ 阅读全文
posted @ 2018-05-16 15:41 苗妙苗 阅读(134) 评论(0) 推荐(0)
摘要:[抄题]: Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead. Note:The s 阅读全文
posted @ 2018-05-13 10:13 苗妙苗 阅读(250) 评论(0) 推荐(0)
摘要:[抄题]: Given an array of strings, group anagrams together. Example: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: 不知道k-v怎么存 阅读全文
posted @ 2018-05-05 23:45 苗妙苗 阅读(282) 评论(0) 推荐(0)
摘要:[抄题]: Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences 阅读全文
posted @ 2018-04-27 16:01 苗妙苗 阅读(121) 评论(0) 推荐(0)
摘要:[抄题]: Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by ot 阅读全文
posted @ 2018-04-27 09:09 苗妙苗 阅读(153) 评论(0) 推荐(0)
摘要:[抄题]: Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You nee 阅读全文
posted @ 2018-04-26 15:45 苗妙苗 阅读(149) 评论(0) 推荐(0)
摘要:[抄题]: We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an intege 阅读全文
posted @ 2018-04-26 10:58 苗妙苗 阅读(142) 评论(0) 推荐(0)
摘要:[抄题]: he set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to anot 阅读全文
posted @ 2018-04-25 21:59 苗妙苗 阅读(159) 评论(0) 推荐(0)