Eat Study Love

먹고 공부하고 사랑하라

혼코딩 82

Convert 1D Array Into 2D Array[E,Array,Matrix,Simulation]

https://leetcode.com/problems/convert-1d-array-into-2d-array/description/You are given a 0-indexed 1-dimensional (1D) integer array original, and two integers, m and n. You are tasked with creating a 2-dimensional (2D) array with  m rows and n columns using all the elements from original.The elements from indices 0 to n - 1 (inclusive) of original should form the first row of the constructed 2D ..

Coding_Practice 2024.07.26

Adding Spaces to a String[M,ArrayTwo Pointers,String,Simulation]

https://leetcode.com/problems/adding-spaces-to-a-string/description/You are given a 0-indexed string s and a 0-indexed integer array spaces that describes the indices in the original string where spaces will be added. Each space should be inserted before the character at the given index.For example, given s = "EnjoyYourCoffee" and spaces = [5, 9], we place spaces before 'Y' and 'C', which are at..

Coding_Practice 2024.07.26

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