Build rows of Pascal's triangle in two different ways, and use them to check the sums of the coefficients.
The idea. Each coefficient is the one before it times . The next row comes from adding neighbours. The odd-placed and the even-placed terms of row each add up to .
Your tasks.
row, return the coefficients of row n, built place by place with the ratio rule.next_row, return the row below a given row, using Pascal's rule.even_odd, return the pair (sum of the odd-placed terms, sum of the even-placed terms) of row n.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…