LeetCode “Rotate Image” (#48) asks you to rotate an n × n square matrix 90° clockwise in-place (i.e., without returning…
Browsing: Medium
Struggling with the “Longest Consecutive Sequence” problem on LeetCode? This blog will help you understand the problem, walk you through…
Are you struggling with the “Rearrange Array Elements by Sign” problem on LeetCode? Don’t worry! In this blog, we’ll break…
Find the shortest clear path from the top-left to bottom-right of a 0-1 grid. We explain the intuition, walk through…
See how to run Dijkstra with a set instead of a heap. We break down the idea, walk through clear…
Find the Shortest Path in an Undirected Graph from a source to every other node when every edge costs 1.…
Check if you can finish every course when some need to be done first. We build the course graph, run…
Learn how to detect cycle in a directed graph with Kahn’s algorithm. Simple intuition, commented Python code, step-by-step dry run,…
Learn how to perform topological sorting of a DAG using Kahn’s algorithm (BFS based). Clear steps, commented Python code, dry-run…
See how to solve “detect cycle in a directed graph” using depth-first search and two helper arrays. Simple idea, commented…