목록해시 (37)
넘치게 채우기
https://leetcode.com/problems/convert-an-array-into-a-2d-array-with-conditions/description/ Convert an Array Into a 2D Array With Conditions - LeetCode Can you solve this real interview question? Convert an Array Into a 2D Array With Conditions - You are given an integer array nums. You need to create a 2D array from nums satisfying the following conditions: * The 2D array should contain only th..
https://leetcode.com/problems/largest-substring-between-two-equal-characters/description/ Largest Substring Between Two Equal Characters - LeetCode Can you solve this real interview question? Largest Substring Between Two Equal Characters - Given a string s, return the length of the longest substring between two equal characters, excluding the two characters. If there is no such substring return..
https://leetcode.com/problems/redistribute-characters-to-make-all-strings-equal/description/ Redistribute Characters to Make All Strings Equal - LeetCode Can you solve this real interview question? Redistribute Characters to Make All Strings Equal - You are given an array of strings words (0-indexed). In one operation, pick two distinct indices i and j, where words[i] is a non-empty string, and ..
https://stackoverflow.com/questions/62869571/call-to-implicitly-deleted-default-constructor-of-unordered-set-vectorint ." This d..." data-og-host="stackoverflow.com" data-og-source-url="https://stackoverflow.com/questions/62869571/call-to-implicitly-deleted-default-constructor-of-unordered-set-vectorint" data-og-url="https://stackoverflow.com/questions/62869571/call-to-implicitly-deleted-default..
https://leetcode.com/problems/design-hashset/description/ Design HashSet - LeetCode Can you solve this real interview question? Design HashSet - Design a HashSet without using any built-in hash table libraries. Implement MyHashSet class: * void add(key) Inserts the value key into the HashSet. * bool contains(key) Returns whether the value leetcode.com 문제 유형 : 해시 문제 난이도 : Easy Design a HashSet wi..
https://leetcode.com/problems/top-k-frequent-elements/description/ Top K Frequent Elements - LeetCode Can you solve this real interview question? Top K Frequent Elements - Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] leetcode.com 문제 유형 : 해시, 힙 문제 난이도 : Medium ..
해시 테이블(Hash Table)은 해시 함수를 통해서 얻은 인덱스에 key 와 value값을 저장하는 자료 구조이다. 해시 함수는 같은 key값을 받으면 같은 인덱스값으로 반환시킨다. 해시 함수 해싱을 하는 해시 함수에는 다음과 같은 것들이 있다: 1. Division Method: 가장 쉽고 간단한 방법이다. key값을 해시 테이블의 크기로 나눈 나머지를 인덱스로 정하는 것이다. h(k) = k mod m (k = key, m = size of hash table) m값은 소수이고, 2의 제곱수와 먼 값을 사용해야 효율적이라고 한다. 2. Multiplication Method: key값과 A(0 < A < 1)의 곱의 소수 부분에 테이블의 크기 m을 곱한 값의 정수값을 인덱스로 한다. h(k) = ..