0641-0650

641. Design Circular Deque $\star\star$

642. Design Search Autocomplete System $\star\star\star$

643. Maximum Average Subarray I $\star$

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
class Solution {
 public:
  double findMaxAverage(vector<int>& nums, int k) {
    double sum = accumulate(nums.begin(), nums.begin() + k, 0);
    double ans = sum;

    for (int i = k; i < nums.size(); ++i) {
      sum += nums[i] - nums[i - k];
      ans = max(ans, sum);
    }

    return ans / k;
  }
};

644. Maximum Average Subarray II $\star\star\star$

645. Set Mismatch $\star$

646. Maximum Length of Pair Chain $\star\star$

647. Palindromic Substrings $\star\star$

648. Replace Words $\star\star$

649. Dota2 Senate $\star\star$

650. 2 Keys Keyboard $\star\star$