Skip to content

Commit c2d3abd

Browse files
committed
Updated comments
1 parent fc7eac5 commit c2d3abd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

GrokkingTwoHeaps.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public static int kthLargest(int k, int[] nums) {
4646
}
4747

4848

49-
// Could also separate the min/max into two separate while loops for further optimization, but
50-
// putting both checks in one while loop here to demonstrate the shared code
49+
// Could also separate the min/max logic into two separate while loops for further optimization (max 1 condition
50+
// checked per loop), but I'm putting both checks in one while loop here to demonstrate the shared code
5151
while (i < n) {
5252
if (// Min Heap: pushing LARGEST on
5353
(checkingLargest && nums[i] > heap.peek()) ||

0 commit comments

Comments
 (0)