![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode哈希表
文章平均质量分 56
Bryan要加油
这个作者很懒,什么都没留下…
展开
-
987. Vertical Order Traversal of a Binary Tree[Hard](Leetcode每日一题-2021.07.31)
ProblemGiven the root of a binary tree, calculate the vertical order traversal of the binary tree.For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) and (row + 1, col + 1) respectively. The root of t原创 2021-07-31 22:44:33 · 222 阅读 · 0 评论 -
1713. Minimum Operations to Make a Subsequence[Hard](Leetcode每日一题-2021.07.26)--抄答案
Problem原创 2021-07-26 19:43:47 · 281 阅读 · 0 评论 -
1743. Restore the Array From Adjacent Pairs[Medium](Leetcode每日一题-2021.07.25)
Problem原创 2021-07-26 19:42:54 · 185 阅读 · 0 评论 -
1893. Check if All the Integers in a Range Are Covered[Easy](Leetcode每日一题-2021.07.23)
Problem原创 2021-07-26 19:41:22 · 337 阅读 · 0 评论 -
138. Copy List with Random Pointer[Medium](Leetcode每日一题-2021.07.22)
Problem原创 2021-07-26 19:40:40 · 368 阅读 · 0 评论 -
面试题 10.02. 变位词组[Medium](Leetcode每日一题-2021.07.18)
Problem编写一种方法,对字符串数组进行排序,将所有变位词组合在一起。变位词是指字母相同,但排列不同的字符串。说明:所有输入均为小写字母。不考虑答案输出的顺序。Example输入: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”],输出:[[“ate”,“eat”,“tea”],[“nat”,“tan”],[“bat”]]Solutionclass Solution {public: vector<vector<原创 2021-07-18 22:40:55 · 135 阅读 · 0 评论 -
981. Time Based Key-Value Store[Medium](Leetcode每日一题-2021.07.10)
ProblemDesign a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key’s value at a certain timestamp.Implement the TimeMap class:TimeMap() Initializes the object of the data st原创 2021-07-12 21:33:37 · 213 阅读 · 0 评论 -
930. Binary Subarrays With Sum[Medium](Leetcode每日一题-2021.07.08)
ProblemGiven a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal.A subarray is a contiguous part of the array.Constraints:1 <= nums.length <= 3 * 104nums[i] is either 0 or 1.0 <= goal <= nums原创 2021-07-08 08:40:20 · 251 阅读 · 0 评论 -
1711. Count Good Meals[Medium](Leetcode每日一题-2021.07.07)
ProblemA good meal is a meal that contains exactly two different food items with a sum of deliciousness equal to a power of two.You can pick any two different foods to make a good meal.Given an array of integers deliciousness where deliciousness[i] is t原创 2021-07-08 08:38:43 · 181 阅读 · 0 评论 -
1418. Display Table of Food Orders in a Restaurant[Medium](Leetcode每日一题-2021.07.06)
ProblemGiven the array orders, which represents the orders that customers have done in a restaurant. More specifically orders[i]=[customerNamei,tableNumberi,foodItemi] where customerNamei is the name of the customer, tableNumberi is the table customer sit原创 2021-07-06 21:52:55 · 383 阅读 · 0 评论 -
645. Set Mismatch[Easy](Leetcode每日一题-2021.07.04)
ProblemYou have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of anothe原创 2021-07-06 21:43:59 · 349 阅读 · 0 评论 -
451. Sort Characters By Frequency[Medium](Leetcode每日一题-2021.07.03)
ProblemGiven a string s, sort it in decreasing order based on the frequency of characters, and return the sorted string.Constraints:1 <= s.length <= 5 * 105s consists of English letters and digits.Example1Input: s = “tree”Output: “eert”Exp原创 2021-07-03 21:10:13 · 225 阅读 · 0 评论 -
149. Max Points on a Line[Hard](Leetcode每日一题-2021.06.24)
ProblemGiven an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line.Constraints:1 <= points.length <= 300points[i].length == 2-10^4 <= xi, yi原创 2021-06-24 08:43:46 · 561 阅读 · 0 评论 -
525. Contiguous Array[Medium](Leetcode每日一题-2021.06.03)--抄
ProblemGiven a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.Constraints:1 <= nums.length <= 105nums[i] is either 0 or 1.Example1Input: nums = [0,1]Output: 2Explanation: [0, 1] is the原创 2021-06-04 08:30:50 · 468 阅读 · 0 评论 -
523. Continuous Subarray Sum(Leetcode每日一题-2021.06.02)
Problem原创 2021-06-02 08:49:04 · 339 阅读 · 0 评论 -
1074. Number of Submatrices That Sum to Target[Hard]-210529
ProblemGiven a matrix and a target, return the number of non-empty submatrices that sum to target.A submatrix x1, y1, x2, y2 is the set of all cells matrix[x][y] with x1 <= x <= x2 and y1 <= y <= y2.Two submatrices (x1, y1, x2, y2) and (x1’,原创 2021-05-30 11:36:32 · 460 阅读 · 0 评论 -
1787. Make the XOR of All Segments Equal to Zero[Hard](Leetcode每日一题-2021.05.25)--抄答案
ProblemYou are given an array nums and an integer k. The XOR of a segment [left, right] where left <= right is the XOR of all the elements with indices between left and right, inclusive: nums[left] XOR nums[left+1] XOR … XOR nums[right].Return原创 2021-05-25 08:41:31 · 686 阅读 · 0 评论 -
692. Top K Frequent Words[Medium](Leetcode每日一题-2021.05.20)
ProblemGiven a non-empty list of words, return the k most frequent elements.Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with the lower alphabetical order comes first.Note:You ma原创 2021-05-20 08:39:25 · 258 阅读 · 0 评论 -
13.Roman to Integer[Easy](Leetcode每日一题-2021.05.15)
ProblemRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.For example, 2 is written as II in Roman numeral, just two one’s added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, wh原创 2021-05-15 15:55:12 · 587 阅读 · 0 评论 -
740. Delete and Earn(Leetcode每日一题-2021.05.05)--抄答案
ProblemGiven an array nums of integers, you can perform operations on the array.In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every element equal to nums[i] - 1 or nums[i] + 1.You start with 0 point原创 2021-05-06 08:34:24 · 507 阅读 · 0 评论 -
554. Brick Wall(Leetcode每日一题-2021.05.02)--抄答案
ProblemThere is a rectangular brick wall in front of you with n rows of bricks. The ith row has some number of bricks each of the same height (i.e., one unit) but they can be of different widths. The total width of each row is the same.Draw a vertical li原创 2021-05-02 09:08:08 · 225 阅读 · 0 评论 -
690. Employee Importance(Leetcode每日一题-2021.05.01)
ProblemYou are given a data structure of employee information, which includes the employee’s unique id, their importance value and their direct subordinates’ id.For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee原创 2021-05-01 16:24:33 · 453 阅读 · 0 评论 -
1603. Design Parking System(Leetcode每日一题-2021.03.19)
ProblemDesign a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.Implement the ParkingSystem class:ParkingSystem(int big, int medium, int small) Init原创 2021-03-19 08:32:20 · 556 阅读 · 0 评论 -
706. Design HashMap(Leetcode每日一题-2021.03.14)
ProblemDesign a HashMap without using any built-in hash table libraries.Implement the MyHashMap class:MyHashMap() initializes the object with an empty map.void put(int key, int value) inserts a (key, value) pair into the HashMap. If the key already ex原创 2021-03-14 18:59:36 · 172 阅读 · 0 评论 -
395. Longest Substring with At Least K Repeating Characters(Leetcode每日一题-2021.02.27)--抄答案
ProblemGiven a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greater than or equal to k.Constraints:1 <= s.length <= 10^4s consists of only lowercase Eng原创 2021-02-27 21:28:39 · 157 阅读 · 0 评论 -
697. Degree of an Array(Leetcode每日一题-2021.02.20)
ProblemGiven a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same原创 2021-02-20 17:43:31 · 152 阅读 · 0 评论 -
888. Fair Candy Swap(Leetcode每日一题-2021.02.01)
ProblemAlice and Bob have candy bars of different sizes: A[i] is the size of the i-th bar of candy that Alice has, and B[j] is the size of the j-th bar of candy that Bob has.Since they are friends, they would like to exchange one candy bar each so that a原创 2021-02-01 19:20:59 · 77 阅读 · 0 评论 -
721. Accounts Merge(Leetcode每日一题-2021.01.18)--抄答案
ProblemGiven a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account.Now, we would like to merge these accounts. Two acco原创 2021-01-18 20:42:42 · 224 阅读 · 0 评论 -
205. Isomorphic Strings(Leetcode每日一题-2020.12.27)
ProblemGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another character while preserving the order of characters原创 2020-12-28 21:03:21 · 126 阅读 · 0 评论 -
387. First Unique Character in a String(Leetcode每日一题-2020.12.23)
ProblemGiven a string, find the first non-repeating character in it and return its index. If it doesn’t exist, return -1.Note: You may assume the string contains only lowercase English letters.Examples = “leetcode”return 0.s = “loveleetcode”return原创 2020-12-23 21:12:14 · 122 阅读 · 0 评论 -
290. Word Pattern(Leetcode每日一题-2020.12.16)
ProblemGiven a pattern and a string s, find if s follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s.Constraints:1 <= pattern.length <= 300pattern contain原创 2020-12-16 20:59:48 · 172 阅读 · 0 评论 -
217. Contains Duplicate(Leetcode每日一题-2020.12.13)
ProblemGiven 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 array, and it should return false if every element is distinct.Example1Input: [1,2,3,1]Output: tr原创 2020-12-16 20:56:53 · 104 阅读 · 0 评论 -
49. Group Anagrams(Leetcode每日一题-2020.12.14)
ProblemGiven an array of strings strs, group the anagrams together. You can return the answer in any order.An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly on原创 2020-12-14 21:03:03 · 207 阅读 · 0 评论 -
454. 4Sum II(Leetcode每日一题-2020.11.27)
ProblemGiven four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same length of N where 0 ≤ N ≤ 500. All integers are in the原创 2020-11-27 20:20:16 · 102 阅读 · 0 评论 -
242. Valid Anagram(Leetcode每日一题-2020.11.22)
ProblemGiven two strings s and t , write a function to determine if t is an anagram of s.Example1Input: s = “anagram”, t = “nagaram”Output: trueExample2Input: s = “rat”, t = “car”Output: falseSolutionclass Solution {public: bool isAnagram原创 2020-11-22 10:14:03 · 154 阅读 · 0 评论 -
1248. Count Number of Nice Subarrays(Leetcode每日一题-2020.04.21)
占坑原创 2020-04-21 19:10:42 · 212 阅读 · 0 评论 -
349. Intersection of Two Arrays(Leetcode每日一题-2020.11.02)
ProblemGiven two arrays, write a function to compute their intersection.Note:Each element in the result must be unique.The result can be in any order.Example1Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2]Example2Input: nums1 = [4,9,5], nu原创 2020-11-03 20:50:15 · 140 阅读 · 0 评论 -
140. Word Break II(Leetcode每日一题-2020.11.01)
ProblemGiven a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences.Note:The same word in the dictionar原创 2020-11-01 22:11:34 · 166 阅读 · 0 评论 -
381. Insert Delete GetRandom O(1) - Duplicates allowed(Leetcode每日一题-2020.10.31)
ProblemDesign a data structure that supports all following operations in average O(1) time.Note: Duplicate elements are allowed.insert(val): Inserts an item val to the collection.remove(val): Removes an item val from the collection if present.getRand原创 2020-11-01 22:09:21 · 185 阅读 · 0 评论 -
1207. Unique Number of Occurrences(Leetcode每日一题-2020.10.28)
ProblemGiven an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique.Constraints:1 <= arr.length <= 1000-1000 <= arr[i] <= 1000Example1Input: arr = [1,2原创 2020-10-28 21:14:24 · 167 阅读 · 0 评论