1674. Minimum Moves to Make Array Complementary.cpp
Code\n\nclass Solution {\npublic:\n  int minMoves(vector<int>& nums, int limit) {\n    vector<int>table(limit + limit + 2, 0);      \n    for(int i = 0, j = num
**Code**\n```\nclass Solution {\npublic:\n  int minMoves(vector<int>& nums, int limit) {\n    vector<int>table(limit + limit + 2, 0);      \n    for(int i = 0, j = nums.size()-1; i < j; i++, j--){\n      if(nums[i] > nums[j]) swap(nums[i], nums[j]);\n      table[nums[i]+1]--, table[nums[j]+1+limit]++;\n    }    \n    int sum = nums.size();\n    for(int i = 0; i != table.size(); i++)\n      table[i] = sum += table[i]; \n    for(int i = 0, j = nums.size()-1; i < j; i++, j--)\n      table[nums[i] + nums[j]]--;    \n    return *min_element(table.begin(), table.end());\n  }\n};\n```
['C']