mirror of
https://github.com/krahets/hello-algo.git
synced 2026-10-21 13:35:21 +08:00
fix: sync array, deque, and printing fixes across translations (#1973)
Synchronize the fixes from #1936, #1824, and #1961 across translated editions and normalize C# and Dart formatting. Move Java CI to Ubuntu 24.04 so its Java 11/17 checks can run.
This commit is contained in:
@@ -76,25 +76,27 @@ class LinkedListDeque {
|
||||
if (isEmpty())
|
||||
throw new IndexOutOfBoundsException();
|
||||
int val;
|
||||
// 要素が1つの場合、先頭と末尾は同じノードを指す
|
||||
if (queSize == 1) {
|
||||
val = front.val;
|
||||
front = null;
|
||||
rear = null;
|
||||
}
|
||||
// キュー先頭からの取り出し
|
||||
if (isFront) {
|
||||
else if (isFront) {
|
||||
val = front.val; // 先頭ノードの値を一時保存
|
||||
// 先頭ノードを削除
|
||||
ListNode fNext = front.next;
|
||||
if (fNext != null) {
|
||||
fNext.prev = null;
|
||||
front.next = null;
|
||||
}
|
||||
fNext.prev = null;
|
||||
front.next = null;
|
||||
front = fNext; // 先頭ノードを更新する
|
||||
// キュー末尾からの取り出し
|
||||
} else {
|
||||
val = rear.val; // 末尾ノードの値を一時保存
|
||||
// 末尾ノードを削除
|
||||
ListNode rPrev = rear.prev;
|
||||
if (rPrev != null) {
|
||||
rPrev.next = null;
|
||||
rear.prev = null;
|
||||
}
|
||||
rPrev.next = null;
|
||||
rear.prev = null;
|
||||
rear = rPrev; // 末尾ノードを更新する
|
||||
}
|
||||
queSize--; // キューの長さを更新
|
||||
|
||||
Reference in New Issue
Block a user