From 557af5736ecc9f38633bb4fc5d2fb1d2d18f3391 Mon Sep 17 00:00:00 2001 From: ElementSnow10 Date: Tue, 17 Dec 2024 11:11:59 +0530 Subject: [PATCH] Update 3-A.cpp Initialized best_cnt with LLONG_MAX. --- two-pointers/3-A.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/two-pointers/3-A.cpp b/two-pointers/3-A.cpp index 11e587e..55a1fa3 100644 --- a/two-pointers/3-A.cpp +++ b/two-pointers/3-A.cpp @@ -15,7 +15,7 @@ std::pair find_songs_to_listen(const std::vector & if (threshold == 0) { return {0, times * songs_size}; } - unsigned long long current_cnt = 0, current_sum = 0, best_cnt = -1; + unsigned long long current_cnt = 0, current_sum = 0, best_cnt = LLONG_MAX; // since we are trying to minimize best_cnt. int best_start = 0; for (int current_start = 0; current_start < songs_size; ++current_start) { while (current_sum > threshold) {