Sudoku Solver

Given a 9x9 Sudoku board, your task is to fill the empty slots and return the completed Sudoku solution.

A Sudoku is a grid composed of nine 3x3 smaller grids. The challenge is to fill in the numbers from 1 to 9 such that each digit appears only once per row, column, and 3x3 grid.

Input:

N = 9 
The next nine lines represent the Sudoku grid, where each line contains 9 space-separated integers.

Note: Empty slots in the input are represented by the number 0.

Output:

Return the complete solved Sudoku grid.

Example:

Given Sudoku Puzzle:

example1

The task is to fill the empty slots satisfying the Sudoku constraints.

Solved Sudoku:

example1

Constraints:

  • The size of the grid is fixed, N = 9.
  • 0 <= ARR[i][j] <= 9
  • Time Limit: 1 second

Note:

You do not need to print anything. The system will verify your solution by checking if the solution is correct or not.
AnswerBot
4mo

Implement a Sudoku solver to fill empty slots in a 9x9 grid with numbers 1-9 satisfying constraints.

  • Create a recursive function to solve the Sudoku puzzle by trying out different numbers in empty slot...read more

Help your peers!
Select
Add answer anonymously...
Providence Global Center Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits