Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion two-pointers/3-A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ std::pair<int, unsigned long long> find_songs_to_listen(const std::vector<int> &
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) {
Expand Down