Skip to content

Commit fddd61f

Browse files
authored
Update maximum-tastiness-of-candy-basket.cpp
1 parent 2bcc7b3 commit fddd61f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/maximum-tastiness-of-candy-basket.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Time: O(nlogr), r is max(price) - min(price)
1+
// Time: O(nlogr), r = max(price)-min(price)
22
// Space: O(1)
33

44
// binary search, greedy
55
class Solution {
66
public:
77
int maximumTastiness(vector<int>& price, int k) {
8-
const auto& check = [&](int x) {
8+
const auto& check = [&](int x) { // find max cnt if smallest absolute difference >= x
99
int cnt = 0, prev = 0;
1010
for (int i = 0, j = 0; i < size(price); ++i) {
1111
if (prev && price[i] - prev < x) {

0 commit comments

Comments
 (0)