feat(content): function signatures + test cases

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

View File

@@ -9,6 +9,26 @@ categories:
patterns:
- heap
function_signature: "class DetectSquares:\n def __init__(self): ...\n def add(self, point: list[int]) -> None: ...\n def count(self, point: list[int]) -> int: ..."
test_cases:
visible:
- input: { operations: ["DetectSquares", "add", "add", "add", "count", "count", "add", "count"], arguments: [[], [[3, 10]], [[11, 2]], [[3, 2]], [[11, 10]], [[14, 8]], [[11, 2]], [[11, 10]]] }
expected: [null, null, null, null, 1, 0, null, 2]
- input: { operations: ["DetectSquares", "add", "add", "add", "add", "count"], arguments: [[], [[0, 0]], [[0, 1]], [[1, 0]], [[1, 1]], [[0, 0]]] }
expected: [null, null, null, null, null, 1]
hidden:
- input: { operations: ["DetectSquares", "count"], arguments: [[], [[5, 5]]] }
expected: [null, 0]
- input: { operations: ["DetectSquares", "add", "count"], arguments: [[], [[0, 0]], [[0, 0]]] }
expected: [null, null, 0]
- input: { operations: ["DetectSquares", "add", "add", "add", "add", "add", "add", "add", "add", "count"], arguments: [[], [[0, 0]], [[0, 2]], [[2, 0]], [[2, 2]], [[0, 0]], [[0, 2]], [[2, 0]], [[2, 2]], [[0, 0]]] }
expected: [null, null, null, null, null, null, null, null, null, 4]
- input: { operations: ["DetectSquares", "add", "add", "add", "add", "count", "count"], arguments: [[], [[0, 0]], [[0, 5]], [[5, 0]], [[5, 5]], [[0, 0]], [[2, 2]]] }
expected: [null, null, null, null, null, 1, 0]
- input: { operations: ["DetectSquares", "add", "add", "add", "add", "add", "add", "count"], arguments: [[], [[0, 0]], [[0, 3]], [[3, 0]], [[3, 3]], [[0, 1]], [[1, 0]], [[1, 1]]] }
expected: [null, null, null, null, null, null, null, 0]
description: |
You are given a stream of points on the X-Y plane. Design an algorithm that: