kyu_5.sum_of_pairs package

Submodules

kyu_5.sum_of_pairs.sum_pairs module

kyu_5.sum_of_pairs.sum_pairs.simplify(ints: list) → list[source]

In order to speed up the process we should simplify the input list by reducing duplicate values, see sample below:

[1,4,5,1,1,1,1,1,4,7,8] >>> [1,4,5,1,4,7,8]

Parameters

ints – a list of integers

Returns

simplified list of integers

kyu_5.sum_of_pairs.sum_pairs.sum_pairs(ints: list, s: int)[source]

Given a list of integers and a single sum value, returns the first two values (parse from the left please) in order of appearance that add up to form the sum.

Parameters
  • ints – a list of integers

  • s – a single sum value

Returns

the first two values = s

kyu_5.sum_of_pairs.test_sum_pairs module

Testing ‘sum_pairs’ function

class kyu_5.sum_of_pairs.test_sum_pairs.SumPairsTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing ‘sum_pairs’ function

test_sum_pairs()[source]

Testing ‘sum_pairs’ function

Given a list of integers and a single sum value, the function should return the first two values (parse from the left please) in order of appearance that add up to form the sum.

Module contents