Skip to content

Interview question · Graphs

01 Matrix

01 Matrix is a Medium question that uses the graphs pattern. PrepKit files it under Graphs.

PrepKit lists the title and a link. The problem statement stays on the original site.

Checking your saved items

Copyright and correction requests

Source content: English

Key facts

Topic
Graphs
Pattern
graphs
Difficulty
Medium
Appears in
Grind 75
Website
leetcode.com
License
MIT License

How to use it

  1. Read the problem on the original site.
  2. Try it on your own before you look at hints or solutions.
  3. Then work through a related question with the same pattern.

About the Graphs pattern

PrepKit study notes. PrepKit editors wrote these as general advice. They are not taken from the problem or from any published solution.

What it is
Problems about items and the connections between them, explored with breadth-first search, depth-first search, topological ordering or shortest-path methods.
How to recognize it
The question involves networks, dependencies, grids you can move through, islands, or anything you can model as nodes and edges.
Common pitfalls
Visiting nodes twice because the visited set is missing or updated too late, treating directed edges as undirected, and missing parts of a disconnected graph.

Related preparation

These are PrepKit study suggestions, not employer endorsements or predictions of interview questions.

Pages that include this

Common questions

Where can I practice 01 Matrix?

Open it on leetcode.com. PrepKit links there and does not copy the problem.

What pattern does 01 Matrix use?

PrepKit files it under graphs, at Medium difficulty.

Source and license

Source and license

License:
MIT License
Author:
Yangshun Tay
Source version:
e1d28e8
Last checked against the source:
Changes:
PrepKit kept only Grind 75 question titles, difficulty, topic, and LeetCode links. The weekly schedule, durations, and ordering are not copied, and no LeetCode problem text is stored.
Visit original source
Full license and copyright notice

MIT License Copyright (c) 2017-Present Yangshun Tay Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.