전체 글 422

[Graphs-BFS][Medium] 994. Rotting Oranges

https://leetcode.com/problems/rotting-oranges/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. 주어진 grid에서 각 숫자는 다음을 의미한다. 이때 모든 orange가 rotten 상태로 변화는 시간(단계 수)을 구하라. Solution. 위 문제인 지나갈 수 있는 길에서 모든 길에 도달하는 단계 ..

Leetcode/Challenges 2024.02.14

[Graphs-BFS][Medium] 1926. Nearest Exit from Entrance in Maze

https://leetcode.com/problems/nearest-exit-from-entrance-in-maze/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. 주어진 maze에서 '.'은 빈칸을, '+'은 벽을 의미한다. entrance에 있다고 가정하면, 출구까지의 최소 이동수를 구하라. 이때 출구는 외부 경계에 위치한 빈칸인..

Leetcode/LeetCode75 2024.02.13

[Graphs-DFS][Medium] 399. Evaluate Division

https://leetcode.com/problems/evaluate-division/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. 주어진 수식과 그 식에 해당하는 values가 함께 주어진다. 이때 입력된 queries에 대한 결과를 찾아 출력하라. Solution Graph 카테고리의 좋은 문제. 데이터의 의미를 파악할 줄 알아..

Leetcode/LeetCode75 2024.02.12

[Graphs-DFS][Medium] 1466. Reorder Routes to Make All Paths Lead to the City Zero

https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. n개의 도시수가 있고, 각 도시 노드의 연결 데이터가 주어진다. 이때 어떤 도시에서든, 0 도시에 도달 할 수 있도록, 변경해야 하는 ..

Leetcode/Challenges 2024.02.09

[Graphs-DFS][Medium] 547. Number of Provinces

https://leetcode.com/problems/number-of-provinces/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. 주어진 vector는 각 노드에 대한 연결 유무를 의미한다. 이때 서로 연결되지 않은 노드 덩어리의 수를 구하라. Solution. 그래프의 기본기를 확인하는 좋은 문제라 할 수 있겠다. 우선 노드..

Leetcode/LeetCode75 2024.02.07

[Graphs - DFS][Medium] 841. Keys and Rooms

https://leetcode.com/problems/keys-and-rooms/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. 각 배열안의 숫자는 각 접근 가능한 index를 의미한다. 0 번 index는 접근 가능하다고 할때, 모든 index를 접근 가능한지 여부를 반환하라. Solution tree의 접근법과 거의 같다고 생각하..

Leetcode/LeetCode75 2024.02.07

[Monotonic Stack][Medium] 901. Online Stock Span

https://leetcode.com/problems/online-stock-span/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. next()를 통해 그 날의 stock price가 주어진다. 연속해서 이 값보다 같거나 적은 날의 수를 반환하라. Solution. 주어진 모든 input를 list나 vector로 저장한다. 뒤에서..

Leetcode/LeetCode75 2024.02.06

[Monotonic Stack][Medium] 739. Daily Tempreatures

https://leetcode.com/problems/daily-temperatures/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. 주어진 배열은 각 날짜의 온도를 의미한다. 각 날짜에서 해당 일보다 더 따뜻한 날을 만나기까지 기다려야 하는 날 수를 출력하라. Solution. 일단 2중 배열을 돌면 해결은 간단해 진다. 하지만 ..

Leetcode/LeetCode75 2024.02.04

[Interval][Medium] 452. Minimum Number of Arrows to Burst Balloons

https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. 주어진 input을 풍선의 직선에서의 좌표라고 가정한다. 이때 풍선을 모두 떠뜨릴 수 있는 화살의 수를 구하라. 겹쳐진 풍선은 모두 한번에 떠뜨릴 수 있다...

Leetcode/LeetCode75 2024.02.04

[Interval][Medium] 435. Non-overlapping Intervals.

https://leetcode.com/problems/non-overlapping-intervals/description LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Q. start와 end로 이루어진 다수의 interval들이 input으로 주어진다. 겹치는 구간이 존재할때, 이 겹치는 구간을 제거해서 interval이 겹쳐지지 않도록 하라. 이때 이 제..

Leetcode/LeetCode75 2024.02.01