PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Pinterest

Solve a 9x9 Sudoku puzzle

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem-solving skills focused on constraint satisfaction, state-space search, and implementation correctness for combinatorial puzzles.

  • hard
  • Pinterest
  • Coding & Algorithms
  • Machine Learning Engineer

Solve a 9x9 Sudoku puzzle

Company: Pinterest

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

Given a partially filled **9×9 Sudoku** board, fill the empty cells so that the completed board is valid. A valid Sudoku satisfies: - Each row contains digits **1–9** with no repetition. - Each column contains digits **1–9** with no repetition. - Each of the nine **3×3 sub-boxes** contains digits **1–9** with no repetition. ### Input - A 9×9 grid of characters where each cell is either `'1'..'9'` or `'.'` (empty). ### Output - Modify the board in-place (or return the completed board) so it becomes a valid solved Sudoku. ### Assumptions / Constraints - The input is guaranteed to have **at least one solution**. - You may assume the puzzle has a **unique solution** unless stated otherwise. ### Example Input: - Row 1: `5 3 . . 7 . . . .` - Row 2: `6 . . 1 9 5 . . .` - ... Output: a completed valid Sudoku grid.

Quick Answer: This question evaluates algorithmic problem-solving skills focused on constraint satisfaction, state-space search, and implementation correctness for combinatorial puzzles.

Related Interview Questions

  • Maximize Boxes Stored Through One Entrance - Pinterest (medium)
  • Solve Multiple Coding Interview Problems - Pinterest (medium)
  • Implement a Sparse Matrix Class - Pinterest (medium)
  • Assign Pins to Shortest Columns - Pinterest (medium)
  • Design Hierarchical Permission Checks - Pinterest (medium)
Pinterest logo
Pinterest
Dec 13, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
10
0

Given a partially filled 9×9 Sudoku board, fill the empty cells so that the completed board is valid.

A valid Sudoku satisfies:

  • Each row contains digits 1–9 with no repetition.
  • Each column contains digits 1–9 with no repetition.
  • Each of the nine 3×3 sub-boxes contains digits 1–9 with no repetition.

Input

  • A 9×9 grid of characters where each cell is either '1'..'9' or '.' (empty).

Output

  • Modify the board in-place (or return the completed board) so it becomes a valid solved Sudoku.

Assumptions / Constraints

  • The input is guaranteed to have at least one solution .
  • You may assume the puzzle has a unique solution unless stated otherwise.

Example

Input:

  • Row 1: 5 3 . . 7 . . . .
  • Row 2: 6 . . 1 9 5 . . .
  • ...

Output: a completed valid Sudoku grid.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Pinterest•More Machine Learning Engineer•Pinterest Machine Learning Engineer•Pinterest Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.