- 428
- 354 488
cpwithcpp
India
Registrace 7. 05. 2021
A competitive programming enthusiast solving and helping others solve programming problems.
Leetcode Weekly Contest 385 | All Problems | Video Editorial C++
Hi I hope you are doing well. In this video I have explained the solutions to all problems of Leetcode Weekly Contest 385. I hope you enjoy the video and don't forget to drop a like and subscribe.
Chapters :
00:00 - Introduction
00:28 - B : Find the Length of the Longest Common Prefix
07:10 - C : Most Frequent Prime
16:30 - D : Count Prefix and Suffix Pairs II
Subscribe and Keep Coding.
#codeforces #codeforcessolutions #codeforcessolution #c++ #competitiveprogramming #programming #geeksforgeeks
Chapters :
00:00 - Introduction
00:28 - B : Find the Length of the Longest Common Prefix
07:10 - C : Most Frequent Prime
16:30 - D : Count Prefix and Suffix Pairs II
Subscribe and Keep Coding.
#codeforces #codeforcessolutions #codeforcessolution #c++ #competitiveprogramming #programming #geeksforgeeks
zhlédnutí: 335
Video
Meeting Rooms III | 18 Feb POTD | Leetcode Problem of the Day
zhlédnutí 707Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : leetcode.com/problems/meeting-rooms-iii/description/ Problem Solution : github.com/importlogic/leetcode-potd/blob/main/2024/02 - February/18-02-2024.cpp Subscribe and Keep Coding. #leetcode #POTD #problemoftheday #competetiveprogramming #c
Sum of leaf nodes in BST | 18 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 710Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : www.geeksforgeeks.org/problems/sum-of-leaf-nodes-in-bst/1 Problem Solution : github.com/importlogic/gfg-potd/blob/main/2024/02 - February/18-02-2024.cpp Subscribe and Keep Coding. #GFG #POTD #geeksforgeeks #problemoftheday #competetiveprogramming #c
Furthest Building You Can Reach | 17 Feb POTD | Leetcode Problem of the Day
zhlédnutí 466Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : leetcode.com/problems/furthest-building-you-can-reach/description/ Problem Solution : github.com/importlogic/leetcode-potd/blob/main/2024/02 - February/17-02-2024.cpp Subscribe and Keep Coding. #leetcode #POTD #problemoftheday #competetiveprogramming #c
Does array represent Heap | 17 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 553Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : www.geeksforgeeks.org/problems/does-array-represent-heap4345/1 Problem Solution : github.com/importlogic/gfg-potd/blob/main/2024/02 - February/17-02-2024.cpp Subscribe and Keep Coding. #GFG #POTD #geeksforgeeks #problemoftheday #competetiveprogramming #c
Flatten BST to sorted list | 16 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 781Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : www.geeksforgeeks.org/problems/flatten-bst-to-sorted-list 111950/1 Problem Solution : github.com/importlogic/gfg-potd/blob/main/2024/02 - February/16-02-2024.cpp Subscribe and Keep Coding. #GFG #POTD #geeksforgeeks #problemoftheday #competetiveprogramming #c
Least Number of Unique Integers after K Removals | 16 Feb POTD | Leetcode Problem of the Day
zhlédnutí 367Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : leetcode.com/problems/least-number-of-unique-integers-after-k-removals/description/ Problem Solution : github.com/importlogic/leetcode-potd/blob/main/2024/02 - February/16-02-2024.cpp Subscribe and Keep Coding. #leetcode #POTD #problemoftheday #competetiveprogramming #c
Find Polygon With the Largest Perimeter | 15 Feb POTD | Leetcode Problem of the Day
zhlédnutí 411Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : leetcode.com/problems/find-polygon-with-the-largest-perimeter/description/ Problem Solution : github.com/importlogic/leetcode-potd/blob/main/2024/02 - February/15-02-2024.cpp Subscribe and Keep Coding. #leetcode #POTD #problemoftheday #competetiveprogramming #c
Count all Possible Path | 15 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 1KPřed 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : www.geeksforgeeks.org/problems/castle-run3644/1 Problem Solution : github.com/importlogic/gfg-potd/blob/main/2024/02 - February/15-02-2024.cpp Subscribe and Keep Coding. #GFG #POTD #geeksforgeeks #problemoftheday #competetiveprogramming #c
Find all Critical Connections in the Graph | 14 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 736Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : www.geeksforgeeks.org/problems/critical-connections/1 Problem Solution : github.com/importlogic/gfg-potd/blob/main/2024/02 - February/14-02-2024.cpp Subscribe and Keep Coding. #GFG #POTD #geeksforgeeks #problemoftheday #competetiveprogramming #c
Rearrange Array Elements by Sign | 14 Feb POTD | Leetcode Problem of the Day
zhlédnutí 169Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : leetcode.com/problems/rearrange-array-elements-by-sign/description/ Problem Solution : github.com/importlogic/leetcode-potd/blob/main/2024/02 - February/14-02-2024.cpp Subscribe and Keep Coding. #leetcode #POTD #problemoftheday #competetiveprogramming #c
Find First Palindromic String in the Array | 13 Feb POTD | Leetcode Problem of the Day
zhlédnutí 195Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : leetcode.com/problems/find-first-palindromic-string-in-the-array/description/ Problem Solution : github.com/importlogic/leetcode-potd/blob/main/2024/02 - February/13-02-2024.cpp Subscribe and Keep Coding. #leetcode #POTD #problemoftheday #competetiveprogramming #c
Clone an Undirected Graph | 13 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 859Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : www.geeksforgeeks.org/problems/clone-graph/1 Problem Solution : github.com/importlogic/gfg-potd/blob/main/2024/02 - February/13-02-2024.cpp Subscribe and Keep Coding. #GFG #POTD #geeksforgeeks #problemoftheday #competetiveprogramming #c
Recursive sequence | 12 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 475Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : www.geeksforgeeks.org/problems/recursive-sequence1611/1 Problem Solution : github.com/importlogic/gfg-potd/blob/main/2024/02 - February/12-02-2024.cpp Subscribe and Keep Coding. #GFG #POTD #geeksforgeeks #problemoftheday #competetiveprogramming #c
Majority Element | 12 Feb POTD | Leetcode Problem of the Day
zhlédnutí 153Před 6 měsíci
Hi I hope you were able to understand the problem solution. Here are a few links for you to check out. Problem Statement : leetcode.com/problems/majority-element/description/ Problem Solution : github.com/importlogic/leetcode-potd/blob/main/2024/02 - February/12-02-2024.cpp Subscribe and Keep Coding. #leetcode #POTD #problemoftheday #competetiveprogramming #c
Cherry Pickup II | 11 Feb POTD | Leetcode Problem of the Day
zhlédnutí 306Před 6 měsíci
Cherry Pickup II | 11 Feb POTD | Leetcode Problem of the Day
Recamans sequence | 11 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 512Před 6 měsíci
Recamans sequence | 11 Feb POTD | Geeks for Geeks Problem of the Day
Palindromic Substrings | 10 Feb POTD | Leetcode Problem of the Day
zhlédnutí 394Před 6 měsíci
Palindromic Substrings | 10 Feb POTD | Leetcode Problem of the Day
Number of paths in a matrix with k coins | 10 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 1,1KPřed 6 měsíci
Number of paths in a matrix with k coins | 10 Feb POTD | Geeks for Geeks Problem of the Day
Check for Children Sum Property in a Binary Tree | 09 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 635Před 6 měsíci
Check for Children Sum Property in a Binary Tree | 09 Feb POTD | Geeks for Geeks Problem of the Day
Largest Divisible Subset | 09 Feb POTD | Leetcode Problem of the Day
zhlédnutí 418Před 6 měsíci
Largest Divisible Subset | 09 Feb POTD | Leetcode Problem of the Day
Perfect Squares | 08 Feb POTD | Leetcode Problem of the Day
zhlédnutí 488Před 7 měsíci
Perfect Squares | 08 Feb POTD | Leetcode Problem of the Day
Check if all leaves are at same level | 08 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 696Před 7 měsíci
Check if all leaves are at same level | 08 Feb POTD | Geeks for Geeks Problem of the Day
Min distance between given nodes of a Binary Tree | 07 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 721Před 7 měsíci
Min distance between given nodes of a Binary Tree | 07 Feb POTD | Geeks for Geeks Problem of the Day
Sort Characters By Frequency | 07 Feb POTD | Leetcode Problem of the Day
zhlédnutí 262Před 7 měsíci
Sort Characters By Frequency | 07 Feb POTD | Leetcode Problem of the Day
Node at distance | 06 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 950Před 7 měsíci
Node at distance | 06 Feb POTD | Geeks for Geeks Problem of the Day
Group Anagrams | 06 Feb POTD | Leetcode Problem of the Day
zhlédnutí 290Před 7 měsíci
Group Anagrams | 06 Feb POTD | Leetcode Problem of the Day
Sorted insert for circular linked list | 05 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 649Před 7 měsíci
Sorted insert for circular linked list | 05 Feb POTD | Geeks for Geeks Problem of the Day
First Unique Character in a String | 05 Feb POTD | Leetcode Problem of the Day
zhlédnutí 150Před 7 měsíci
First Unique Character in a String | 05 Feb POTD | Leetcode Problem of the Day
Subtraction in Linked List | 04 Feb POTD | Geeks for Geeks Problem of the Day
zhlédnutí 896Před 7 měsíci
Subtraction in Linked List | 04 Feb POTD | Geeks for Geeks Problem of the Day
Great explaination. It was hard to find video with simple explanation. Finally found this. Keep posting.
while i try to submit my code it asks to do cf config then login while i put my login id credentials it does not take them and tells csrf . how to correct this ?
thank you
simplest and best explanation available !!
I have some problems on compiler it shows me compile error
what this v vector ( 2D ) is storing
Great explanation of B. Thanks.
Please continue cfg problem of the day...
how can I format code in CP editor, In VS code its really easy ! Its looks really good after formatting the code !
Missing your potd videos !
May I know why you stop gfg daily problem? It's really helpful to people like us, who are learning how to code through that videos?
Amazing approach
Thanks ,was having a hard time with que B
what s the logiciel u are using sir ?
what is your whiteboard name? please i need to know
sir please keep uploading contest solutions videos....great explanation....really helpful !!!
irritating animation on half of the screen. can't watch it
Thank u so much for clearing all my confusions 🤗
how to add debug.h file for cpp in cp editor
not clear what's k/(n-1)!
Miss your daily potd videos
did you left codefores? you are not doing any contest lately.
Sir podt ki videos kyu nhi aa rhi hai
bro when will you upload next potd video
great explanation
waiting for daily videos
bro video dalte jao yarr we are waiting
is there any way to solve this using javascript with the same time complexity?
Great explanation
Great initiative for the Contest answers....
Thanks you please continue daily
great explanation 😍😍😍
explanation is awesome ....❤❤
nice
sir when will codeforces editorials come back 😭.
Thank you for uploading so early in the morning !
sir yee wla sol kuy kam nehi kar raha haii map<int,int>mp; for(auto it:arr)mp[it]++; set<int>st; for(auto it :mp){ if(it.second<=k){ k-=it.second; it.second=0; }else{ break; } } for(auto it:mp)st.insert(it.second); return st.size()-1;
Great explanation
5:19 The degree of all the nodes is not even. You can see that the bottom left most and right most nodes have odd degree (3).
That example doesn’t satisfy the given condition that all edges must be visited.
Good Explanation Bro! 🦾
Very Nice Logic Sir 💞💞💞💞💞💞
Cf k editorials continue kijya
it can be done using booyer moore's algorithm in O(1) space complexity instead of using a map
i was stuck on this question for hours and spent a lot of my energy going through soo many videos on youtube. This video of yours is a real gem. literally the best explanation for this question across the youtube, Thank you so much sir . 🙏🙏
Please make a video for todays leetcode contest question maximum palindromes after any operations
which software you are using to explain the question?
long long dp[101][101][101]; long long solve(vector<vector<int>> &arr,int &n,int i,int j, int sum){ if(i==n-1 and j==n-1 ) return dp[i][j][sum]= sum == arr[i][j]; if(dp[i][j][sum]!=-1) return dp[i][j][sum]; dp[i][j][sum]=0; if(arr[i][j] <= sum){ if(i+1<n) dp[i][j][sum]+=solve(arr,n,i+1,j,sum-arr[i][j]); if(j+1<n) dp[i][j][sum]+=solve(arr,n,i,j+1,sum-arr[i][j]); } return dp[i][j][sum]; } long long numberOfPath(int n, int k, vector<vector<int>> &arr){ // Code Here memset(dp,-1,sizeof(dp)); return solve(arr,n,0,0,k); }
Nice explanation, can you please come with DP series
why is this code giving runtime error //{ Driver Code Starts #include<bits/stdc++.h> using namespace std; // } Driver Code Ends class Solution { public: long long numberOfPath(int n, int k, vector<vector<int>> &arr){ // Code Here vector<vector<vector<long long>>> dp(n, vector<vector<long long>>(n, vector<long long>(k + 1, 0))); // Initialization for the starting point dp[0][0][arr[0][0]] = 1; for(int s = 0; s <= k; s++) { for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { int left = 0, up = 0; if(i == 0 && j == 0) continue; if (i > 0 && arr[i][j] <= s) up = dp[i-1][j][s-arr[i][j]]; if (j > 0 && arr[i][j] <= s) left = dp[i][j-1][s-arr[i][j]]; dp[i][j][s] = up + left; } } } return dp[n-1][n-1][k]; } };
The code you provided has an issue in the initialization of the `dp` array. Specifically, the initialization of `dp[0][0][arr[0][0]]` is causing a runtime error because it is trying to access an out-of-bounds element. Here's the corrected code: ```cpp #include<bits/stdc++.h> using namespace std; class Solution { public: long long numberOfPath(int n, int k, vector<vector<int>> &arr){ vector<vector<vector<long long>>> dp(n, vector<vector<long long>>(n, vector<long long>(k + 1, 0))); // Initialize dp[0][0][0] to 1 dp[0][0][0] = 1; for(int s = 1; s <= k; s++) { for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(i == 0 && j == 0) continue; if(arr[i][j] > s) continue; long long up = (i > 0) ? dp[i-1][j][s-arr[i][j]] : 0; long long left = (j > 0) ? dp[i][j-1][s-arr[i][j]] : 0; dp[i][j][s] = up + left; } } } return dp[n-1][n-1][k]; } }; int main() { Solution obj; int n = 3, k = 12; vector<vector<int>> arr = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; cout << obj.numberOfPath(n, k, arr) << endl; return 0; } ``` This corrected code initializes `dp[0][0][0]` to `1` instead of `dp[0][0][arr[0][0]]` and ensures that the correct elements of `dp` are accessed and updated within the loops.
Bro this code is getting accepted #include <vector> using namespace std; class Solution { public: vector<vector<vector<long long>>> dp; long long helper(int r, int c, int sum, int n, const vector<vector<int>>& arr) { if (sum < 0) return 0; if (arr[r][c] > sum) return 0; if (r == n - 1 && c == n - 1) return (arr[r][c] == sum); if (dp[r][c][sum] != -1) return dp[r][c][sum]; long long paths = 0; for (auto d : dir) { int nr = r + d[0]; int nc = c + d[1]; if (nr >= 0 && nc >= 0 && nr < n && nc < n) { paths += helper(nr, nc, sum - arr[r][c], n, arr); } } return dp[r][c][sum] = paths; } long long numberOfPath(int n, int k, const vector<vector<int>>& arr) { dp.assign(n, vector<vector<long long>>(n, vector<long long>(k + 1, -1))); return helper(0, 0, k, n, arr); } private: const vector<vector<int>> dir = {{1, 0}, {0, 1}}; };