This explanation is way better than any other video!
@kumkumslab581113 күн бұрын
Bhai chess khela karo 3:50 par knight usi row me kyu nhi aa skti 💀💀💀💀
@Abhay1414 күн бұрын
8:15 teri maaki .... chup hoja sale 😂😂😂
@MO-fg2cm23 күн бұрын
you just yapped ... yet i understood the approach Thanks
@libaafroz636223 күн бұрын
i am here only to see the implementation of yes cases
@Kirtinasha99924 күн бұрын
Thanks for your easy-to-understand explanation!
@dakshmaru8055Ай бұрын
AMAZING PROBLEM WITH AMAZING SOLUTION
@adithyan9103Ай бұрын
nunnu touching solution
@abhishekkudwa51502 ай бұрын
in first example why can z[i] = 11 , it can contain all of the letters starting from index 0 = 'a'.
@aiyanshahid73742 ай бұрын
isse acha parha ta hi nhi bhai bakwas
@chinmay44522 ай бұрын
I am getting RE for solution with O(n*x) space and O(n*x) time. But it is working on gfg. I have tried with the tabulation as well #include <bits/stdc++.h> using namespace std; #define int long long #define ll long long int mod = 1e9+7; vector<vector<int>>dp; int rec(int n, int sum , int arr[]){ if(sum == 0){ return 0; } if(n==0){ return 1e8; } if(dp[n][sum] != -1){ return dp[n][sum]; } if(arr[n-1] <= sum){ return dp[n][sum] = min(1+rec(n,sum-arr[n-1],arr) , rec(n-1,sum,arr)); }else{ return dp[n][sum] = rec(n-1,sum,arr); } } int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n;cin >> n; int k;cin >> k; dp.resize(n+1,vector<int>(k+1,-1)); cout << rec(n,k,arr) << endl; return 0; }
@addictedtocricket88272 ай бұрын
#include <iostream> #include <unordered_map> using namespace std; unordered_map<long long, int> collatz_cache; int collatz_length(long long n) { if (n == 1) return 1; if (collatz_cache.find(n) != collatz_cache.end()) return collatz_cache[n]; if (n % 2 == 0) { collatz_cache[n] = 1 + collatz_length(n / 2); } else { collatz_cache[n] = 1 + collatz_length(3 * n + 1); } return collatz_cache[n]; } void weirdAlgo(long long n) { while (n != 1) { cout << n << " "; if (collatz_cache.find(n) != collatz_cache.end()) { n = collatz_length(n); } else if (n % 2 == 0) { n = n / 2; } else { n = 3 * n + 1; } } cout << "1"; return; } int main() { long long n; cin >> n; weirdAlgo(n); return 0; } the code shown in the video is showing tle. here is the optimized solution of the given problem
@اللهمعيوبهاكتفي-ج7ج3 ай бұрын
Please enable Arabic translation please
@alokkumarsingh46413 ай бұрын
this can be achieved only with lower_bound or upper_bound also??
Nice solution for those who understand some concepts and are not blindly attempting this code just to make a contest submission
@nebulagaming86214 ай бұрын
Kya overlap kr rha hai kis-se?
@prakhargarg41664 ай бұрын
bakwas
@Abc-lr4bf4 ай бұрын
very well explained , thanks !
@nownow10254 ай бұрын
thanks.Very good explanation.
@im_ykp5 ай бұрын
The explanation was amazing
@AdityaGupta-kv5ip5 ай бұрын
i think the test cases are updated now and this is not working for the test case n=10, k=2, [5, 3, 5, 6, 9, 3, 7, 6, 6, 1] Its giving output as [2, 2, 1, 3, 0, -2, -5, -6, -11] but the correct output is [2, 2, 1, 3, 6, 4, 1, 0, 5]. Can you please tell how to solve this.
@tufani82995 ай бұрын
worst method i have an easy approach for this
@SuccessAccount-c4v5 ай бұрын
thank you
@Schrodinger-g5x5 ай бұрын
#include<bits/stdc++.h> using namespace std; #define inf LLONG_MAX #define pb push_back #define rep(i,a,b) for(int i = a; i < b; i++) #define all(x) x.begin(),x.end() #define in(a) for(int i = 0; i<a.size(); i++) cin>>a[i]; #define out(a) for(int i = 0; i<a.size(); i++) cout<<a[i]<<" "; typedef vector<int> vi; #define sqrt(x) sqrtl(x) #define ret(a) cout<<a<<" "; return #define ppb pop_back #define mp make_pair #define set_bits(x) __builtin_popcountll(x) #define sz(x) ((int)(x).size()) #define next " " void printbinary(int n){ if(n > 0) { printbinary(n / 2);} else {return;} cout<<(n & 1);return;} const int N = 1e5 + 10; const int M = 1e9 + 7; vector<int> primes(N); vector<int> factorial(N); vector<int> inversefactorial(N); void fastio(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int32_t main(){ fastio(); int t; cin>>t; while(t--){ int n; cin>>n; map<int,int> m; vector<int> v(n); for(int i = 0 ; i < n ; ++i){ cin>>v[i]; m[v[i]] = i + 1; } int count = 0; for(int i = 1; i <= 2*n ; i++){ for(int j = i + 1 ; j <= 2*n ; j++){ if((i*j) > (2*n)){ break; } int product = i * j; auto index1 = m.find(i); auto index2 = m.find(j); if((index1 == m.end()) or (index2 == m.end())){ continue; } if((*index1).second + (*index2).second == product){ count++; } } } cout<<count<<endl; } } Exact same code but giving tle can you tell me why?????
@dank70445 ай бұрын
very nice explanation and very reusable logic
@scythee89486 ай бұрын
abbay bhai line kiu ni bani
@DarkKnight-o8w6 ай бұрын
You need to work on your explanation. Wasted my time.
@kumkumslab58116 ай бұрын
TLE
@abdullahwaseem99176 ай бұрын
bkl delete kidher hai
@VishalYadav-gk1kg7 ай бұрын
Very nice explanation sir, Thank you!
@BombSquadHindiTipsTricks7 ай бұрын
launch and texts file does what exactly?
@Negijicoder7 ай бұрын
what happen if we take example : A-> abcde, B-> bcdef and n= 5, k = 5 then we can make A->B but for this logic we can't ???
@kushagragupta1497 ай бұрын
bro jab dp use krni thi to trie ka kya kam? nodes to banaye nhi
@NeverLoose-v5i7 ай бұрын
can we do th thing like a condition by traversing a simple djkt and push the node with cost and also with cost/2 then which ever gives the minimum take it
@md.shazidalhasan67267 ай бұрын
thanks
@k_CO_Sachin7 ай бұрын
Thanks for this awesome and concise explanation...
@VishalYadav-gk1kg8 ай бұрын
Very nice explanation sir, Thank you!
@VishalYadav-gk1kg8 ай бұрын
Very nice explanation sir, Thank you!
@vaibhav28638 ай бұрын
sir can you share link of code
@TechWithOtmane8 ай бұрын
kzbin.info/www/bejne/lXWrc6OQnsp2rbc
@sujalsharmavlogs00708 ай бұрын
Bhai, sahi se samajh mein nahi aaya pahle to, but idea lag gaya, aur cout n times karke complexity high ho jayegi isliye use string mein append karke ek saath print karo, printing one time is more feasible
@SaquibAnsariofficial019 ай бұрын
#include <iostream> #include <vector> using namespace std; typedef long long ll; void dfs(ll node, vector<ll> &vis, vector<vector<ll>> &adj, vector<ll> &ans) { vis[node] = 1; ans.push_back(node); for (auto it : adj[node]) { if (!vis[it]) { dfs(it, vis, adj, ans); } } } void solve() { ll n; cin >> n; vector<ll> v(n); for (auto &it : v) { cin >> it; } if(n==1 and v[0]==1){ cout<<2<<" "<<1<<endl; return; } vector<vector<ll>> adj(n + 2); for (int i = 0; i < n + 2; i++) { adj[i].clear(); } vector<ll> vis(n + 2, 0); for (int i = 1; i < n; i++) { adj[i].push_back(i + 1); } for (int i = 1; i < n; i++) { if (v[i] == 0) { adj[i + 1].push_back(n + 1); } else { adj[n + 1].push_back(i + 1); } } vector<ll> ans; dfs(1, vis, adj, ans); for(int i=1;i<=n+1;i++){ if(vis[i]==0){ cout<<-1<<endl; return; } } for (auto it : ans) { cout << it << " "; } cout << endl; } int main() { ll test; cin >> test; while (test--) { solve(); } return 0; } hwats wrong in my logic....?
@vinamrasangal84369 ай бұрын
chutiya explaination
@piyushgarg24029 ай бұрын
bro kya fook ke aaya he
@shubhsinha38969 ай бұрын
worst explanation possible.
@pallavi_chandaka94809 ай бұрын
Informative video
@shrodingerscat709910 ай бұрын
one way can be to formulate it as perfix sum problem sum(l,r) = psum(r) - psum(l-1) now it is good subarray if psum(r) - psum(l-1) = r - l + 1 psum(r) - r = psum(l-1) - (l-1) which gives indeed the prefix sums with same values