# Problem Description
This is a hexagonal pyramid number pattern problem where we need to generate the nth row of numbers following specific rules. Each row contains numbers arranged in hexagonal cells, with the first row having one cell, and each subsequent row adding one more cell than the previous row. The function should return all numbers in the requested row as a list.

# Visual Facts
1. The structure is a triangular arrangement of hexagonal cells
2. Each row n contains n cells
3. Row 1: [2]
4. Row 2: [2, 2]
5. Row 3: [2, 4, 2]
6. Row 4: [2, 6, 6, 2]
7. Row 5: [2, 8, 12, 8, 2]
8. All rows start and end with 2
9. The arrow marks in the image indicate addition relationships between cells

# Visual Patterns
1. Pattern for number of elements:
   - Row n contains n elements

2. Edge elements pattern:
   - First and last elements of every row are always 2

3. Middle elements calculation pattern:
   - For row ≥ 3, each non-edge cell is calculated by adding the two cells above it
   - Example: In row 4, 6 = 2 + 4 (from row 3)
   - Example: In row 5, 12 = 6 + 6 (from row 4)

4. Symmetry pattern:
   - Each row is symmetrical from left to right
   - Example: Row 4: [2, 6, 6, 2]
   - Example: Row 5: [2, 8, 12, 8, 2]


# Solution
from typing import List

def solution(n: int) -> List[int]:
    """
    Returns the numbers in the specified row.

    Parameters:
        n (int): The row number to retrieve. (n > 1)

    Returns:
        List[int]: A list containing all numbers in the nth row.     
    """
    ret = list()
    for i in range(n):
        row = list()
        for j in range(0, i + 1):
            if j == 0 or j == i:
                row.append(2)
            else:
                row.append(ret[i - 1][j] + ret[i - 1][j - 1])
        ret.append(row)
    return ret[n - 1]


# Test Script
def test():
    test_cases = [
        (1, [2]),
        (2, [2, 2]),
        (3, [2, 4, 2]),
        (4, [2, 6, 6, 2]),
        (5, [2, 8, 12, 8, 2]),
        (6, [2, 10, 20, 20, 10, 2]),
        (7, [2, 12, 30, 40, 30, 12, 2]),
        (8, [2, 14, 42, 70, 70, 42, 14, 2]),
        (9, [2, 16, 56, 112, 140, 112, 56, 16, 2]),
        (10, [2, 18, 72, 168, 252, 252, 168, 72, 18, 2]),
    ]

    for n, expected_output in test_cases:
        try:
            output = solution(n)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`n`: {n}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if output != expected_output:
            error_message = (
                f"The following Test Case failed:\n"
                f"`n`: {n}\n\n"
                f"Actual Output: {output}\n"
                f"Expected Output: {expected_output}"
            )
            assert False, error_message

test()