Skip to content

Commit

Permalink
update post
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-jonghoonpark committed Aug 3, 2024
1 parent fbdac2d commit 541b7aa
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions _posts/2024-02-19-leetcode-23.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,24 +215,18 @@ class Solution {
ListNode current = mergedList;

while (true) {
boolean done = true;
int minIndex = 0;
int minIndex = -1;
int currentMin = Integer.MAX_VALUE;

for (int i = 0; i < lists.length; i++) {
ListNode node = lists[i];
if (node == null) {
continue;
}

if (node.val < currentMin) {
if (node != null && node.val < currentMin) {
minIndex = i;
currentMin = node.val;
done = false;
}
}

if (done) {
if (minIndex == -1) {
break;
}

Expand Down

0 comments on commit 541b7aa

Please sign in to comment.