probably the best explanation video for this problem. Thanks
@fitofficial651022 күн бұрын
excellent man, love from Bangladesh
@lakshitgupta874926 күн бұрын
i like the way you teach i finallu understand why we need prefix sum
@hitxrth29 күн бұрын
Great Explanation.
@unknown-ey4zmАй бұрын
thanks for approach
@rishabhgoel8936Ай бұрын
Stop mugging up the code !!
@SahilNarwal-e7vАй бұрын
Thanks for good explanation :)
@suryanshrastogi1340Ай бұрын
700 likes
@IgenNova102 ай бұрын
literally crystal clear video maja aa gaya
@garvsharma12022 ай бұрын
-1 kab hoga phir?
@anupbhagat20492 ай бұрын
Good Explaination Bhai
@MDABDULLAHALLMAMUN-ez8ut2 ай бұрын
Your explanation is amazing.
@sajidqureshi60982 ай бұрын
great explanation broo!!!
@amimultamim98933 ай бұрын
awesome explanation. Thanks a lot.
@thomanani68263 ай бұрын
Great video brother
@learnenglishwithyash68784 ай бұрын
solution code kaha hai sir last me screenshot lagaya karo pls
@KrishGupta-g6r4 ай бұрын
Kya pdhaya hai sir🎉🎉❤
@eshworroy73964 ай бұрын
good explaination
@ugthesep57064 ай бұрын
maana padega bhaiya kya samajhte hai aak dum mast
@KaziRifatAlMuin4 ай бұрын
Thanks a lot. That is an excellent explanation, a new concept learned!
@kz_cbble96704 ай бұрын
you are repeating yourself 3 to 4 times per sentence. Please be more concise
@utkarshjaiswal4734 ай бұрын
Brilliant explanation..
@nomanrishad27404 ай бұрын
Keep up the good work.
@manishmahajan60945 ай бұрын
Great explanation!
@Rishi4415 ай бұрын
Amazing Explaination Sir🔥🔥
@Mihir_kathpal5 ай бұрын
very good explainations , Thanks buddy
@riyadhossain17065 ай бұрын
mind-blowing explanation
@toxiclucien81685 ай бұрын
great explanation bro
@Jahangirhussenkawsar5 ай бұрын
how could understand n-(a+b)>=2 why not ==1 where writtem we need 2 extra sell?? please say bro
@esha26885 ай бұрын
Thankyiu sir!! This was much needed❤
@mlkgpta28695 ай бұрын
Summary of Concept: - Understanding the problem - you have to identify total number of subsegments where every pair in that subsegment are friends Let's take an example for that n is 5 m is 3 1 2 2 3 4 5 Let's go step by step let's everyone are in standing in sequence from 1 to n - We will calculate nearest right which is not friend - for 1 it is 2, for 2 it is 3, for 4 it is 5 and for 5 everyone are friends Since we need to check between a and b where anything between them are not pairs to identify nearest right which is non friend, we'll loop backwards: - For 5 it's nearest friend on right is at 6, - For 4 it's nearest friend is at 4 itself - For 3 it's nearest friend is at 4 - For 2 it is 2 itself - For 1 it is 1 itself Now calculating total subsegments it would be: 1,2,3,(3,4),4,5 total 6 please correct/improve if possible
@dank70445 ай бұрын
nice video man thanks a lot
@technologybaba1926 ай бұрын
Excellent explanation sir Thank you very much 😊
@birajitnath18716 ай бұрын
Thank u very much
@ryanaggarwal20566 ай бұрын
bro the code is giving tle at test case 3 i tried it fking 17 times with different variations but its still not working!!!!!
hey can you explain what's wrong with my code, it gives WA at some hidden test case #include <bits/stdc++.h> using namespace std; #define int long long #define pairs pair<int, int> #define vll vector<int> #define vps vector<pairs> #define ip(arr) for(int i = 0; i < arr.size(); i++) cin >> arr[i]; #define op(arr) for(int i = 0; i < arr.size(); i++) { cout << arr[i] << " "; } cout << endl; #define all(s) s.begin(), s.end() #define rall(s) s.rbegin(), s.rend() #define fast_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define mod 1000000007 bool solve(vector<vll> &arr){ int n = arr.size(); set<int>st; bool ans = false; for(int i = 0; i<n; i++){ int set = arr[i].size(); bool flag = true; for(int j = 0; j<set; j++){ int curr = arr[i][j]; if(st.find(curr) == st.end()){ flag = false; } st.insert(curr); } if(flag) ans = true; } return ans; } signed main() { fast_io; int t ; cin>>t; while (t--) { int n; cin>>n; vector<vector<int>> arr; for(int i = 0; i<n; i++){ int k; cin>>k; vll curr; while(k--){ int temp; cin>>temp; curr.push_back(temp); } arr.push_back(curr); } bool ans1 = solve(arr); reverse(all(arr)); bool ans2 = solve(arr); bool ans = ans1||ans2; cout<<(ans?"yes":"no")<<endl; // for(auto i : arr){ // for(auto j : i){ // cout<<j<<" "; // } // cout<<endl; // } } return 0; } I am comparing the OR of all elements before the current element from both sides(ans1 for forward and ans2 for reverse). If a subsequence exists for the given condition, the ON bits must be a subset of the larger counterpart. For ex: 1011 and 1010 will satisfy only when the ON bits in one digit is a subset of another, this can be extended to more than one numbers as OR operation can never turn OFF a bit. Please help whats wrong with my approach.
@Jquee9997 ай бұрын
i cried in this problem, was not able to solve since march of this year
@swarbhatia7 ай бұрын
well explained!
@SuccessAccount-c4v8 ай бұрын
best explanation ever
@SuccessAccount-c4v8 ай бұрын
Thank you sir
@harshkankariya44238 ай бұрын
It is really a very good problem and level is more than medium
@BholendraSingh-xc3pk8 ай бұрын
Hi, Are you currently working with GeeksForGeeks?
@competitivedoubt24658 ай бұрын
KUDOS SIR .... AWESOME EXPLANATIONNNN
@aseembaranwal9 ай бұрын
WHat is the reason to choose 10^10 as the upper limit for the search space?