Eat Study Love

먹고 공부하고 사랑하라

daily code 14

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 13:40:31

VS code C++ Debugging & Operator overloading

이번엔, C++ 코딩을 하며 자주 마주하는 디버깅의 현장을 살펴보겠다. 관련자료는 아래와 같다.  용량이 크진 않으니 VS Code를 통해 C++ 코딩 작업을 할 경우, 잘 참고해서 하면 되겠다. 기본적으로 디버깅할땐 print문을 통해서 디버깅하는 방법이 있고, VS Code 상의 Debug Extention을 이용하는 방법이 있다. 전자는 직관적이지만, 귀찮고 후자는 효과적이지만 방법을 터득하기가 귀찮다. 일단 간단하게 Debugging 실습을 진행해보자. #include #include using namespace std;int main(){ list lst = {1,2,3,4,5}; // i want to practice using pop_back function in list! ..

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

Make Lexicographically Smallest Array by Swapping Elements(Array,Union Find,Sorting)

https://leetcode.com/problems/make-lexicographically-smallest-array-by-swapping-elements/description/?envType=daily-question&envId=2025-01-25You are given a 0-indexed array of positive integers nums and a positive integer limit.In one operation, you can choose any two indices i and j and swap nums[i] and nums[j] if |nums[i] - nums[j]| Return the lexicographically smallest array that can be obtai..

Coding_Practice 2025.01.25

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

Trapping Rain Water II(Array,Breadth-First Search,Heap (Priority Queue),Matrix)

https://leetcode.com/problems/trapping-rain-water-ii/?envType=daily-question&envId=2025-01-19 Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining. Example 1:Input: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]Output: 4Explanation: After the rain, water is trapped between the blocks..

Coding_Practice 2025.01.19

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

Remove loop in Linked List(Linked List,two-pointer,algorithm,Data Structures,Algorithms) - 플로이드의 사이클 감지 알고리즘 (Floyd's Cycle Detection Algorithm)

https://www.geeksforgeeks.org/problems/remove-loop-in-linked-list/1?page=1&category=Linked%20List&difficulty=Medium,Hard&sortBy=submissions Remove loop in Linked List | Practice | GeeksforGeeksGiven the head of a linked list that may contain a loop.  A loop means that the last node of the linked list is connected back to a node in the same list.  So if the next of the previous node is null. then..

Coding_Practice 2024.12.17

Minesweeper[Array,Depth-First Search,Breadth-First Search,Matrix]

https://leetcode.com/problems/minesweeper/description/Let's play the minesweeper game (Wikipedia, online game)!You are given an m x n char matrix board representing the game board where:'M' represents an unrevealed mine,'E' represents an unrevealed empty square,'B' represents a revealed blank square that has no adjacent mines (i.e., above, below, left, right, and all 4 diagonals),digit ('1' to '..

Coding_Practice 2024.12.04