From f40d9891a84f2c0d560cc4ec6561d6a76c231939 Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:47:43 +0530 Subject: [PATCH] Create 2028. Find Missing Observations --- 2028. Find Missing Observations | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 2028. Find Missing Observations 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; + } +};