feat(content): function signatures + test cases

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

View File

@@ -9,6 +9,26 @@ categories:
patterns:
- prefix-sum
function_signature: "def odd_cells(m: int, n: int, indices: list[list[int]]) -> int:"
test_cases:
visible:
- input: { m: 2, n: 3, indices: [[0, 1], [1, 1]] }
expected: 6
- input: { m: 2, n: 2, indices: [[1, 1], [0, 0]] }
expected: 0
hidden:
- input: { m: 1, n: 1, indices: [[0, 0]] }
expected: 1
- input: { m: 3, n: 3, indices: [[0, 0], [1, 1], [2, 2]] }
expected: 0
- input: { m: 2, n: 2, indices: [[0, 0]] }
expected: 3
- input: { m: 5, n: 5, indices: [[0, 0], [0, 1], [0, 2]] }
expected: 20
- input: { m: 3, n: 4, indices: [[0, 0], [1, 1], [0, 1]] }
expected: 6
description: |
There is an `m x n` matrix that is initialised to all `0`'s. There is also a 2D array `indices` where each `indices[i] = [r_i, c_i]` represents a **0-indexed location** to perform some increment operations on the matrix.