본문 바로가기

알고리즘

Open the Lock (BFS) 이번 문제 역시 LeetCode의 Stack, Queue 튜토리얼에 있는 'Open the Lock'이라는 문제다. Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com Queue를 활용해서 BFS 방식으로 푸는게 목적이기 때문에 지난번 Number of Islands처럼 DFS같은 방법은 사용하지 않고 진행했다. 이번 문제는 다음과 같다. 0, 1, 2, .. 더보기
Number of Islands (DFS) 예전에 LeetCode에서 Queue를 공부할 때 Number of Islands라는 문제를 푼 적이 있다. 2020/07/21 - [알고리즘/LeetCode] - Number of Islands using BFS Number of Islands using BFS 제목만 보면 거창해 보이지만 옛날 포스팅과 마찬가지로 게으름뱅이가 자신의 안타까운 코딩 능력을 체감하고 반성하는 의미에서 적는 글이다. 여기서 다루는 문제는 LeetCode의 Explore 탭에서 제 haruhiism.tistory.com 그때는 문제에서도 Queue 자료구조를 활용한 BFS를 요구했기 때문에 이를 활용했지만 최근 다시 공부하면서 풀이를 되새겨보니 꼭 이를 사용하지 않아도 문제를 풀 수 있을 것 같아 풀이를 조금 바꿔보았다. c.. 더보기
Number of Islands (BFS) 제목만 보면 거창해 보이지만 옛날 포스팅과 마찬가지로 게으름뱅이가 자신의 안타까운 코딩 능력을 체감하고 반성하는 의미에서 적는 글이다. 여기서 다루는 문제는 LeetCode의 Explore 탭에서 제공하는 "Queue and BFS" 챕터에서 풀어볼 수 있는 문제 "Number of Islands"다. https://leetcode.com/explore/learn/card/queue-stack/231/practical-application-queue/1374/ Account Login - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepa.. 더보기