# breaking it down medium

The Fair Cut

One chocolate bar, two siblings, and a single cut between squares — can peace be achieved? 🍫

You get the sweetness of each squares. Print the smallest number of squares the LEFT piece can have so both pieces are equally sweet, or no fair cut.

Example:

Input: squares = [3, 1, 2, 2] Output: 2

The whole bar sums to 8. Cutting after 2 squares gives a left side of 3 + 1 = 4 and a right side of 2 + 2 = 4 — equally sweet.

💡 need a hint?

brk-fair-cut.py🔒 given lines are locked — write your code in between
loading...