mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-29 03:17:13 +00:00
build
This commit is contained in:
@@ -401,7 +401,7 @@ comments: true
|
||||
backtrack(state.clone(), choices, selected, res);
|
||||
// 回退:撤銷選擇,恢復到之前的狀態
|
||||
selected[i] = false;
|
||||
state.remove(state.len() - 1);
|
||||
state.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -950,7 +950,7 @@ comments: true
|
||||
backtrack(state.clone(), choices, selected, res);
|
||||
// 回退:撤銷選擇,恢復到之前的狀態
|
||||
selected[i] = false;
|
||||
state.remove(state.len() - 1);
|
||||
state.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2830,6 +2830,9 @@ comments: true
|
||||
/* 佇列首出列 */
|
||||
func (q *arrayDeque) popFirst() any {
|
||||
num := q.peekFirst()
|
||||
if num == nil {
|
||||
return nil
|
||||
}
|
||||
// 佇列首指標向後移動一位
|
||||
q.front = q.index(q.front + 1)
|
||||
q.queSize--
|
||||
@@ -2839,6 +2842,9 @@ comments: true
|
||||
/* 佇列尾出列 */
|
||||
func (q *arrayDeque) popLast() any {
|
||||
num := q.peekLast()
|
||||
if num == nil {
|
||||
return nil
|
||||
}
|
||||
q.queSize--
|
||||
return num
|
||||
}
|
||||
|
||||
@@ -1762,6 +1762,10 @@ comments: true
|
||||
/* 出列 */
|
||||
func (q *arrayQueue) pop() any {
|
||||
num := q.peek()
|
||||
if num == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 佇列首指標向後移動一位,若越過尾部,則返回到陣列頭部
|
||||
q.front = (q.front + 1) % q.queCapacity
|
||||
q.queSize--
|
||||
|
||||
Reference in New Issue
Block a user