feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent b434eb3a49
commit a7d29b7cce
203 changed files with 4526 additions and 0 deletions

View File

@@ -10,6 +10,28 @@ categories:
patterns:
- linkedlist-reversal
function_signature: "def add_two_numbers(l1: ListNode, l2: ListNode) -> ListNode:"
test_cases:
visible:
- input: { l1: [7, 2, 4, 3], l2: [5, 6, 4] }
expected: [7, 8, 0, 7]
- input: { l1: [2, 4, 3], l2: [5, 6, 4] }
expected: [8, 0, 7]
- input: { l1: [0], l2: [0] }
expected: [0]
hidden:
- input: { l1: [9, 9, 9], l2: [1] }
expected: [1, 0, 0, 0]
- input: { l1: [5], l2: [5] }
expected: [1, 0]
- input: { l1: [1, 2, 3, 4, 5], l2: [6, 7, 8, 9] }
expected: [1, 9, 1, 3, 4]
- input: { l1: [9, 9, 9, 9, 9], l2: [9, 9, 9, 9, 9] }
expected: [1, 9, 9, 9, 9, 8]
- input: { l1: [1], l2: [9, 9, 9, 9] }
expected: [1, 0, 0, 0, 0]
description: |
You are given two **non-empty** linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.