Lessons
C++ · Searching and Sorting · 36. Binary Search on the Answer

step 1 of 6

A yes/no checker

Three boards: 8, 12 and 5 long. Can I cut k pieces of length len? enough answers yes or no.

Look: all the yeses come first, then only no's. The answer switches once.

Mission

Ask for 6 pieces instead. Where does yes switch to no now?

PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
← press me!
readyscreen

Press RUN to see what this program does.

Do the mission and Next turns green.

Binary Search on the Answer