Stick and planks problem

Question

Hints

Answer