class Solution { public: int getMissingNumber(vector<int>& nums) { int n = nums.size() + 1; int sum = (0 + n - 1) * n / 2; for (int i = 0; i < nums.size(); i++) sum -= nums[i]; return sum; } };