- 32
- 3 484
Shekhar Gupta
India
Приєднався 28 лип 2022
Codeforces Round 995 | Div 3 | 2051 D | Counting Pairs | Binary Search and PBDS Approach | C++
Codeforces Round 995 | Div 3 | 2051 D | Counting Pairs | Binary Search and PBDS Approach | C++
Переглядів: 98
Відео
Leetcode 3397 | Weekly Contest 429 | Maximum Number of Distinct Elements After Operations | C++
Переглядів 3921 день тому
Leetcode 3397 | Weekly Contest 429 | Maximum Number of Distinct Elements After Operations | C
Codeforces Round 986 Div 2 | 2028 B | Alice's Adventures in Permuting | Solution in C++
Переглядів 1012 місяці тому
Codeforces Round 986 Div 2 | 2028 B | Alice's Adventures in Permuting | Solution in C
Codeforces Round 982 Div 2 | 2027 A | Rectangle Arrangement | Solution in C++
Переглядів 112 місяці тому
Codeforces Round 982 Div 2 | 2027 A | Rectangle Arrangement | Solution in C
Codeforces Round 979 Div 2 | 2030 B | Minimise Oneness | Solution in C++
Переглядів 1772 місяці тому
Codeforces Round 979 Div 2 | 2030 B | Minimise Oneness | Solution in C
Codeforces Round 979 Div 2 | 2030 C | A TRUE Battle | Solution in C++
Переглядів 3732 місяці тому
Codeforces Round 979 Div 2 | 2030 C | A TRUE Battle | Solution in C
Codechef Starters 156 contest | Partition Score | PARTSCORE | Solution in C++
Переглядів 442 місяці тому
Codechef Starters 156 contest | Partition Score | PARTSCORE | Solution in C
Codeforces Educational Round 170 Div 2 | 2025 C | New Game | Solution in C++
Переглядів 432 місяці тому
Codeforces Educational Round 170 Div 2 | 2025 C | New Game | Solution in C
Codeforces Educational Round 170 Div 2 | 2025 B | Binomial Coefficients, Kind Of | Solution in C++
Переглядів 262 місяці тому
Codeforces Educational Round 170 Div 2 | 2025 B | Binomial Coefficients, Kind Of | Solution in C
Codeforces Round 977 Div 2 | 2021 C1 | Adjust The Presentation (Easy Version) | Solution in C++
Переглядів 2783 місяці тому
Codeforces Round 977 Div 2 | 2021 C1 | Adjust The Presentation (Easy Version) | Solution in C
Leetcode 2696 | Minimum String Length After Removing Substrings | POTD 7 OCT 2024 | Solution in C++
Переглядів 173 місяці тому
Leetcode 2696 | Minimum String Length After Removing Substrings | POTD 7 OCT 2024 | Solution in C
Codeforces Round 977 Div 2 | 2021 B | Maximize Mex | Solution in C++
Переглядів 7913 місяці тому
Codeforces Round 977 Div 2 | 2021 B | Maximize Mex | Solution in C
Leetcode 2491 | Divide Players Into Teams of Equal Skill | POTD 4 OCT 2024 | Medium | C++
Переглядів 283 місяці тому
Leetcode 2491 | Divide Players Into Teams of Equal Skill | POTD 4 OCT 2024 | Medium | C
Leetcode 884 | Uncommon Words from Two Sentences | POTD 17 Sept 2024 | Easy | Solution in C++
Переглядів 113 місяці тому
Leetcode 884 | Uncommon Words from Two Sentences | POTD 17 Sept 2024 | Easy | Solution in C
Leetcode 1371 | Find the Longest Substring Containing Vowels in Even Counts | POTD 15 Sept 2024 |C++
Переглядів 344 місяці тому
Leetcode 1371 | Find the Longest Substring Containing Vowels in Even Counts | POTD 15 Sept 2024 |C
Leetcode 3290 | Maximum Multiplication Score | Weekly Contest 415 | Medium | Solution in C++
Переглядів 594 місяці тому
Leetcode 3290 | Maximum Multiplication Score | Weekly Contest 415 | Medium | Solution in C
Leetcode 1310 | XOR Queries of a Subarray | POTD 13 Sept 2024 | Solution in C++
Переглядів 264 місяці тому
Leetcode 1310 | XOR Queries of a Subarray | POTD 13 Sept 2024 | Solution in C
Leetcode POTD 12 Sept 2024 | Leetcode 1684 | Count the Number of Consistent Strings | Easy | C++
Переглядів 134 місяці тому
Leetcode POTD 12 Sept 2024 | Leetcode 1684 | Count the Number of Consistent Strings | Easy | C
Leetcode 2220 | Minimum Bit Flips to Convert Number | Easy | POTD 11 Sept 2024 | Solution in C++
Переглядів 134 місяці тому
Leetcode 2220 | Minimum Bit Flips to Convert Number | Easy | POTD 11 Sept 2024 | Solution in C
Leetcode 1945 | Sum of Digits of String After Convert | POTD 3 Sept 2024 | Solution in C++
Переглядів 294 місяці тому
Leetcode 1945 | Sum of Digits of String After Convert | POTD 3 Sept 2024 | Solution in C
Leetcode 947 | Most Stones Removed with Same Row or Column | POTD 29 Aug 2024 | Daily Problem | C++
Переглядів 144 місяці тому
Leetcode 947 | Most Stones Removed with Same Row or Column | POTD 29 Aug 2024 | Daily Problem | C
Leetcode 1514 | Path with Maximum Probability | POTD 27 Aug 2024 | Solution in C++
Переглядів 274 місяці тому
Leetcode 1514 | Path with Maximum Probability | POTD 27 Aug 2024 | Solution in C
Leetcode 1905 | Count sub Islands | POTD 28 Aug 2024 | Daily Problem
Переглядів 234 місяці тому
Leetcode 1905 | Count sub Islands | POTD 28 Aug 2024 | Daily Problem
Leetcode 3249 | Count the Number of Good Nodes | Weekly 410 contest | Solution in C++
Переглядів 575 місяців тому
Leetcode 3249 | Count the Number of Good Nodes | Weekly 410 contest | Solution in C
Leetcode 3070 | Weekly contest 387 | Count Submatrices with Top-Left Element and Sum Less Than k
Переглядів 2910 місяців тому
Leetcode 3070 | Weekly contest 387 | Count Submatrices with Top-Left Element and Sum Less Than k
Codeforces 930 Div 2 | 1937A | Shuffle Party | Solution in C++
Переглядів 41510 місяців тому
Codeforces 930 Div 2 | 1937A | Shuffle Party | Solution in C
Leetcode 2680 | Maximum OR | Bit Manipulation | Medium | Solution in C++
Переглядів 4010 місяців тому
Leetcode 2680 | Maximum OR | Bit Manipulation | Medium | Solution in C
Leetcode 22 | Generate Parantheses | Solution in C++
Переглядів 2510 місяців тому
Leetcode 22 | Generate Parantheses | Solution in C
Codeforces 925 Div 3 | 1931B | Make equal | solution in C++
Переглядів 36611 місяців тому
Codeforces 925 Div 3 | 1931B | Make equal | solution in C
Codeforces 921 Div 2 | 1925B | A balanced Problemset? | solution in c++
Переглядів 11111 місяців тому
Codeforces 921 Div 2 | 1925B | A balanced Problemset? | solution in c
Why we multiplying k time every element like See suppose array contail [a,b,c,d] and K=2 But in solution we are multiply each element 2^k time and checking which or is maximum meand 4 to each element and checking But there can be possibility like first we multiply 2 to b then in k=2 2 to c means final array will be a, 2b,2c,d
Yes but in starting part of the video I explained that why it is better to apply operation to single element only and then update your maximum in starting part.As because applying all k at single will give you addition of 2^m which is greater than 2^(m-1) + 2^(m-2) +....1 means even if you apply like let's suppose k-1 to one element and another to other you can get maximum of 2^(k-1) + 1 which is always less that 2^k In your case for k=2 we can get 2^2 addition means increase in value than if we apply individually which is 1+1 that is 2. I suppose that now you got the point.
awesome explanation
Glad it was helpful!
If string is 00001 Then alice can't put 'or' at last as it's Bob's chance
First is Alice chance so she will put or at position which is before 1 which will make answer as yes and in code also cnt==1 condition will be satisfied at last iteration of loop which will make answer as yes.
bro voice not clear
Okay will improve
Great Solution dude
Glad it helped
@@shekhargupta125 not fully, when I submit your code on codeforces it says that it is not full solution
@@elonmusk1950 did you tried above update in code? There are two while loops that need to be changed from the code that I wrote
Useless logic
Why do you think such?
Just small update in code in both while loops just swap two lines use below while(mp[ans%x]>0) { mp[ans%x]--; ans++; } instead of this while(mp[ans%x]>0) { ans++; mp[ans%x]--; }
Keep it up 🎉🎉🎉
Wah Shekhar bhai wah 🎉
can u please share the project
Yeah, sure I will share it's GitHub link
Time complexity is o(m*n) and Extra Space complexity is o(m*n) of recursion stack space and the equation is fg=fg && g1[i][j] not fg=1 && g1[i][j] in further video.
where are you from ?
Gujarat
In code use (1LL<<j) in place of 1<<j as it will give run time error because int can't handle j after 32
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin>>n; vector<int> a(n); for(int i=0;i<n;++i) { cin>>a[i]; } long long int sum=accumulate(a.begin(),a.end(),0); int element=sum/n; long long int extra=0; for(int i=0;i<n;++i) { if(a[i]>=element) { extra+=(a[i]-element); } else { long long int need=element-a[i]; if(extra>=need) { extra-=(need); } else { cout<<"NO"<<endl; return; } } } cout<<"YES"<<endl; } int main() { int t; cin>>t; while(t--) { solve(); } return 0; } Updated code as there were some changes in code shown in video
Thank you sir for uploading the B question. It really helps us 🙏🙏
There is an update in code part use for(int i=1;i<=sqrt(x);++i) instead of for(int i=0;i<=sqrt(x);++i) as it will lead to division by zero.
Sir please upload Div2 question B
Will upload soon.