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,30 @@ categories:
patterns:
- greedy
function_signature: "def max_profit(prices: list[int]) -> int:"
test_cases:
visible:
- input: { prices: [7, 1, 5, 3, 6, 4] }
expected: 7
- input: { prices: [1, 2, 3, 4, 5] }
expected: 4
- input: { prices: [7, 6, 4, 3, 1] }
expected: 0
hidden:
- input: { prices: [1] }
expected: 0
- input: { prices: [2, 1] }
expected: 0
- input: { prices: [1, 2] }
expected: 1
- input: { prices: [3, 3, 3, 3] }
expected: 0
- input: { prices: [1, 2, 1, 2, 1, 2] }
expected: 3
- input: { prices: [5, 1, 3, 2, 8, 4, 9] }
expected: 14
description: |
You are given an integer array `prices` where `prices[i]` is the price of a given stock on the i<sup>th</sup> day.