diff --git a/2028. Find Missing Observations b/2028. Find Missing Observations new file mode 100644 index 0000000..0807181 --- /dev/null +++ b/2028. Find Missing Observations @@ -0,0 +1,31 @@ +class Solution { +public: + vector missingRolls(vector& rolls, int mean, int n) { + vector ans; + int m=rolls.size(); + int a=(n+m)*mean; + int sum=0; + for(auto num:rolls){ + sum+=num; + } + int target=a-sum; + if(target<=0 || n>target || target>6*n){ + return ans; + } + cout<=1;j--){ + int local=target; + local-=j; + if(local>=n-1-i){ + target=target-j; + ans.push_back(j); + break; + } + } + + } + return ans; + } +};