Grokking Microsoft Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
How to find box key

Joe

Jul 22, 2024

Can someone explain this math to me

i // 3 * 3 + j // 3

0

0

Comments
Comments
Shubham Vora
Shubham Voraa year ago

The expression i // 3 * 3 + j // 3 calculates the box index for a 9x9 Sudoku board, where:

  • i is the row number (0 to 8).

  • j is the column number (0 to 8).

Here's how it works step by step:

  1. i // 3: This divides the row number by 3 and takes the in...
A
annejunkstuff 9 months ago

Shubham gives a good step by step explanation, but my brain wanted a conceptual answer to remember this pattern. I would describe it this way:

We use integer division to map/reduce each row and column multiple of three to the same number so they all point to the same ...

On this page