Eat Study Love

먹고 공부하고 사랑하라

C++ 147

Design HashMap[E,Array,Hash Table,Linked List,Design,Hash Function]

https://leetcode.com/problems/design-hashmap/description/Design 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 exists in the map, update the corresponding value.int get(int key) returns the value to which the s..

Coding_Practice 2024.07.26

Removing Minimum Number of Magic Beans[M,Array,Greedy,Sorting,Enumeration,Prefix Sum]

https://leetcode.com/problems/removing-minimum-number-of-magic-beans/description/You are given an array of positive integers beans, where each integer represents the number of magic beans found in a particular magic bag.Remove any number of beans (possibly none) from each bag such that the number of beans in each remaining non-empty bag (still containing at least one bean) is equal. Once a bean ..

Coding_Practice 2024.07.26

Longest Non-decreasing Subarray From Two Arrays[M,Array,Dynamic Programming]

https://leetcode.com/problems/longest-non-decreasing-subarray-from-two-arrays/You are given two 0-indexed integer arrays nums1 and nums2 of length n.Let's define another 0-indexed integer array, nums3, of length n. For each index i in the range [0, n - 1], you can assign either nums1[i] or nums2[i] to nums3[i].Your task is to maximize the length of the longest non-decreasing subarray in nums3 by..

Coding_Practice 2024.07.24

Review 9 - MST(Minimum Spanning Trees) in C++

https://eglife.tistory.com/98 [Algorithm] Review 8 - Priority Queues and Heaps in C++https://eglife.tistory.com/92 [Main course!] Review 7 - Inheritance in C++https://eglife.tistory.com/89 Review 5 - Special Members in C++https://eglife.tistory.com/88 Review 4 - Class,Overloading,Special Members in C++https://eglife.tistory.com/87 Revieglife.tistory.com본격적으로 알고리즘의 세계에 발을 디뎠다.  1. Graph 이 장을 포함해,..

SW 만학도/C++ 2024.07.24

[Algorithm] Review 8 - Priority Queues and Heaps in C++

https://eglife.tistory.com/92 [Main course!] Review 7 - Inheritance in C++https://eglife.tistory.com/89 Review 5 - Special Members in C++https://eglife.tistory.com/88 Review 4 - Class,Overloading,Special Members in C++https://eglife.tistory.com/87 Review 2 - Functions and Memory Management in C++https://eglife.tistory.com/85eglife.tistory.com 이제 C++의 OOP를 위한 기본적인 공부는 끝이 났다. 이제 좀 Advanced한 영역인데, ..

SW 만학도/C++ 2024.07.22

Determine the Minimum Sum of a k-avoiding Array[M,Math,Greedy]

https://leetcode.com/problems/determine-the-minimum-sum-of-a-k-avoiding-array/description/You are given two integers, n and k.An array of distinct positive integers is called a k-avoiding array if there does not exist any pair of distinct elements that sum to k.Return the minimum possible sum of a k-avoiding array of length n. Example 1:Input: n = 5, k = 4Output: 18Explanation: Consider the k-av..

Coding_Practice 2024.07.22