leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2465.cpp (285B)


      1 class Solution {
      2   public:
      3     int distinctAverages(vector<int> &nums) {
      4         unordered_set<int> us;
      5 
      6         sort(nums.begin(), nums.end());
      7         for (int i = 0, j = nums.size() - 1; i < j; i++, j--)
      8             us.insert(nums[i] + nums[j]);
      9 
     10         return us.size();
     11     }
     12 };