# How To Choose Appropriate Test Cases

I just finished the Divide and Conquer quiz, and the final question had me beat.

https://brilliant.org/practice/divide-and-conquer/?p=6

The solution suggests looking at a 3x3 grid, then a 7x7 grid, and then generalizes. It wasn't at all clear to me that I ought to be approaching test cases this way, i.e., from a 2^n step standpoint. I started with 4, then went to 5. What were the implicit clues or thought processes that might lead someone to the test cases used in the solution? Or is this just a case of guess and check and I wasn't being precise in my guessing?

Note by Wolf Howard
8 months, 4 weeks ago

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$

Sort by:

The thought process often used in these types of problems, is to work backwards, that is to say, "For what size grid could I answer correctly with only one wrong guess, and clearly that would be going right in the middle of a 3x3 grid. Now, once you have that you can say, OK, with 2 guesses I'd like to get it down to just 3x3 grids, which can be done with four 3x3 grids diagonally adjacent to your guess, which leads to a 7x7 grid, and so on...

Leading eventually to a 2^n type pattern, or in this case for n wrong guesses it would lead to an MxM grid where M = 2^{n+1} - 1.

Make sense?

- 8 months, 3 weeks ago

Cheers, great explanation.

- 8 months, 3 weeks ago