-
Notifications
You must be signed in to change notification settings - Fork 0
/
641.设计循环双端队列.rs
78 lines (54 loc) · 1.88 KB
/
641.设计循环双端队列.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* @lc app=leetcode.cn id=641 lang=rust
*
* [641] 设计循环双端队列
*/
// @lc code=start
struct MyCircularDeque {
}
/**
* `&self` means the method takes an immutable reference.
* If you need a mutable reference, change it to `&mut self` instead.
*/
impl MyCircularDeque {
/** Initialize your data structure here. Set the size of the deque to be k. */
fn new(k: i32) -> Self {
}
/** Adds an item at the front of Deque. Return true if the operation is successful. */
fn insert_front(&self, value: i32) -> bool {
}
/** Adds an item at the rear of Deque. Return true if the operation is successful. */
fn insert_last(&self, value: i32) -> bool {
}
/** Deletes an item from the front of Deque. Return true if the operation is successful. */
fn delete_front(&self) -> bool {
}
/** Deletes an item from the rear of Deque. Return true if the operation is successful. */
fn delete_last(&self) -> bool {
}
/** Get the front item from the deque. */
fn get_front(&self) -> i32 {
}
/** Get the last item from the deque. */
fn get_rear(&self) -> i32 {
}
/** Checks whether the circular deque is empty or not. */
fn is_empty(&self) -> bool {
}
/** Checks whether the circular deque is full or not. */
fn is_full(&self) -> bool {
}
}
/**
* Your MyCircularDeque object will be instantiated and called as such:
* let obj = MyCircularDeque::new(k);
* let ret_1: bool = obj.insert_front(value);
* let ret_2: bool = obj.insert_last(value);
* let ret_3: bool = obj.delete_front();
* let ret_4: bool = obj.delete_last();
* let ret_5: i32 = obj.get_front();
* let ret_6: i32 = obj.get_rear();
* let ret_7: bool = obj.is_empty();
* let ret_8: bool = obj.is_full();
*/
// @lc code=end