Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 534 Bytes

File metadata and controls

28 lines (18 loc) · 534 Bytes

Generate all pairs

Instructions

Given positive Int n implement a function which returns a list of containing pairs with all combinations of numbers from 0 to n.

challenge | solution

Examples

Example 1

getAllPairs(0) [Pair(0, 0)]

Example 2

getAllPairs(1) [Pair(0, 0), Pair(0, 1), Pair(1, 0), Pair(1, 1)]

Example 3

getAllPairs(2) [Pair(0, 0), Pair(0, 1), Pair(0, 2), Pair(1, 0), Pair(1, 1), Pair(1, 2), Pair(2, 0), Pair(2, 1), Pair(2, 2)]