Eat Study Love

먹고 공부하고 사랑하라

coding test 53

First Completely Painted Row or Column(Array,Hash Table,Matrix)

https://leetcode.com/problems/first-completely-painted-row-or-column/description/?envType=daily-question&envId=2025-01-20You are given a 0-indexed integer array arr, and an m x n integer matrix mat. arr and mat both contain all the integers in the range [1, m * n].Go through each index i in arr starting from index 0 and paint the cell in mat containing the integer arr[i].Return the smallest inde..

Coding_Practice 2025.01.20

Number of Music Playlists(Math,Dynamic Programming,Combinatorics)

https://leetcode.com/problems/number-of-music-playlists/description/ Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:Every song is played at least once.A song can only be played again only if k other songs have been played.Given n, goal, and k, return the number of po..

Coding_Practice 2025.01.16

Find the Prefix Common Array of Two Arrays(Array,Hash Table,Bit Manipulation)

https://leetcode.com/problems/find-the-prefix-common-array-of-two-arrays/description/?envType=daily-question&envId=2025-01-14You are given two 0-indexed integer permutations A and B of length n.A prefix common array of A and B is an array C such that C[i] is equal to the count of numbers that are present at or before the index i in both A and B.Return the prefix common array of A and B.A sequenc..

Coding_Practice 2025.01.14

Minimum Length of String After Operations(Hash Table,String,Counting)

https://leetcode.com/problems/minimum-length-of-string-after-operations/description/?envType=daily-question&envId=2025-01-13You are given a string s.You can perform the following process on s any number of times:Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one character to the right that is also equal to s[i]..

Coding_Practice 2025.01.13

C++ Object Oriented Programming(OOP), Overroad, Override 실습

C++과 관련된 시험에서 꼭 빠지지 않고 등장하는 것이 이 OOP 문제이다. OOP는 Class를 하나 만들어놓고, 그에 파생되는 객체를 가지고 노는 Programming이다. 이번에 해 볼 실습은, 2D Vector Class를 만들고, 해당 Class에 각 종 Operator를 Overroad 해본 뒤, OOP를 써서 Class 구현이 잘 되었는지 테스트 해보고, 2D Vector를 상속받은 Derived Class 3D Vector를 만들어 Class의 Inherit, Method의 Override를 잘 구현했는지 Test 해보겠다. 문제 풀이를 위한 Skeleton code는 아래와 같다.#include #include using namespace std;// Base class for 2D ve..

LRU Cache [Final 기출] (Hash Table,Linked List,Design,Doubly-Linked List)

https://leetcode.com/problems/lru-cache/description/DBMS Buffer에 Data를 Replace 하는 대표적인 Algorithm 중 하나인 LRU 방법에 대해 Implementation을 해보는 실습을 해본다. 문제 Description은 아래와 같다.Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.Implement the LRUCache class:LRUCache(int capacity) Initialize the LRU cache with positive size capacity.int get(int key) Return the value of ..

Coding_Practice 2025.01.08

Unique Binary Search Trees(Math,Dynamic Programming,Tree,Binary Search Tree,Binary Tree)

https://leetcode.com/problems/unique-binary-search-trees/description/Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n. Example 1:Input: n = 3Output: 5Example 2:Input: n = 1Output: 1 Constraints:1 그래도 가볍게나마 BST문제도 풀어봐야지..! Linked List , Tree 이런 걸 자꾸만 건들자 근데 이건,, Tree 문제라기보단 수학 문제 같다.. 흐음..  1. Python 일단..

Coding_Practice 2025.01.06