feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,40 @@ categories:
|
||||
patterns:
|
||||
- two-pointers
|
||||
|
||||
function_signature: "class MyCircularQueue: ..."
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input:
|
||||
operations: ["MyCircularQueue", "enQueue", "enQueue", "enQueue", "enQueue", "Rear", "isFull", "deQueue", "enQueue", "Rear"]
|
||||
arguments: [[3], [1], [2], [3], [4], [], [], [], [4], []]
|
||||
expected: [null, true, true, true, false, 3, true, true, true, 4]
|
||||
hidden:
|
||||
- input:
|
||||
operations: ["MyCircularQueue", "isEmpty", "enQueue", "isEmpty", "Front", "deQueue", "isEmpty"]
|
||||
arguments: [[1], [], [5], [], [], [], []]
|
||||
expected: [null, true, true, false, 5, true, true]
|
||||
- input:
|
||||
operations: ["MyCircularQueue", "enQueue", "enQueue", "Front", "Rear", "deQueue", "Front"]
|
||||
arguments: [[2], [1], [2], [], [], [], []]
|
||||
expected: [null, true, true, 1, 2, true, 2]
|
||||
- input:
|
||||
operations: ["MyCircularQueue", "deQueue", "Front", "Rear"]
|
||||
arguments: [[3], [], [], []]
|
||||
expected: [null, false, -1, -1]
|
||||
- input:
|
||||
operations: ["MyCircularQueue", "enQueue", "enQueue", "enQueue", "deQueue", "enQueue", "Front", "Rear"]
|
||||
arguments: [[3], [1], [2], [3], [], [4], [], []]
|
||||
expected: [null, true, true, true, true, true, 2, 4]
|
||||
- input:
|
||||
operations: ["MyCircularQueue", "enQueue", "deQueue", "enQueue", "deQueue", "enQueue", "Front", "Rear"]
|
||||
arguments: [[1], [10], [], [20], [], [30], [], []]
|
||||
expected: [null, true, true, true, true, true, 30, 30]
|
||||
- input:
|
||||
operations: ["MyCircularQueue", "isFull", "enQueue", "enQueue", "isFull", "enQueue", "isFull"]
|
||||
arguments: [[2], [], [1], [2], [], [3], []]
|
||||
expected: [null, false, true, true, true, false, true]
|
||||
|
||||
description: |
|
||||
Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, and the last position is connected back to the first position to make a circle. It is also called "Ring Buffer".
|
||||
|
||||
|
||||
Reference in New Issue
Block a user