Day 1: Report Repair¶
Functions:
|
Find the two entries that sum to |
- find_pair_with_sum(items: List[int], total: int) Optional[Tuple[int, int]][source]¶
Find the two entries that sum to
total.- Ensures
result is None or result[0] != result[1] or items.count(result[0]) > 1
(A duplicated result was produced from different input items)
result is not None⇒all(r in items for r in result)(Returned values appear in the input)
result is not None⇒result[0] + result[1] == total(Returned items sum to the right total)