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.
Be the first one to answer
Add answer anonymously...
Providence Global Center Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

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

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter