Eat Study Love

먹고 공부하고 사랑하라

programming practice 32

Permutations(Array,Backtracking)

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Example 1:Input: nums = [1,2,3]Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]Example 2:Input: nums = [0,1]Output: [[0,1],[1,0]]Example 3:Input: nums = [1]Output: [[1]] Constraints:1 -10 All the integers of nums are unique.뭔가 기본적인 컨셉의 문제인데, 이게 또 한 번쯤은 집고 넘어가줘야 찝찝한게 없다..

Coding_Practice 2025.02.10

Maximum Employees to Be Invited to a Meeting(Depth-First Search,Graph,Topological Sort)

https://leetcode.com/problems/maximum-employees-to-be-invited-to-a-meeting/description/?envType=daily-question&envId=2025-01-26A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a large circular table, capable of seating any number of employees.The employees are numbered from 0 to n - 1. Each employee has a favorite person and they will..

Coding_Practice 2025.01.26

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..