Breaking Chocolate Bars — Puzzle for Interview rounds

Placewit
Aug 9, 2021

--

Question :

You have a bar of chocolate that consists of n x m square blocks.

If you can only break one piece at a time, how many breaks are necessary to break the original n x m piece into n*m 1 x 1 pieces?

How many are sufficient?

Solution :

Since every break creates exactly one new piece, n * m - 1 breaks are both necessary and sufficient to create n * m total pieces.

Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

--

--

Placewit
Placewit

Written by Placewit

Upskilling students for tech placements!

No responses yet