Skip to content
We areTOP 1%

Lights Out

EasyRating 900CodeforcesMatrix (2-D Arrays)
Solve on Codeforces(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

A light's final state depends only on the parity of the presses on it and on its side neighbours. Use direction arrays with bounds checks to add up those presses.

More in Matrix (2-D Arrays)

Matrix (2-D Arrays) questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Matrix Diagonal SumLeetCodeEasy Solve Matrix Diagonal Sum on LeetCode (opens in a new tab)
2Beautiful MatrixCodeforcesEasy 800Solve Beautiful Matrix on Codeforces (opens in a new tab)
3Transpose MatrixLeetCodeEasy Solve Transpose Matrix on LeetCode (opens in a new tab)
4Target PracticeCodeforcesEasy 800Solve Target Practice on Codeforces (opens in a new tab)
5Pascal's TriangleLeetCodeEasy Solve Pascal's Triangle on LeetCode (opens in a new tab)
6Lights OutCodeforcesEasy 900Solve Lights Out on Codeforces (opens in a new tab)
7Set Matrix ZeroesLeetCodeMedium Solve Set Matrix Zeroes on LeetCode (opens in a new tab)
8Valid SudokuLeetCodeMedium Solve Valid Sudoku on LeetCode (opens in a new tab)
9Rotate ImageLeetCodeMedium Solve Rotate Image on LeetCode (opens in a new tab)
10Spiral MatrixLeetCodeMedium Solve Spiral Matrix on LeetCode (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account