cpwithcpp
cpwithcpp
  • 428
  • 354 488
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
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

Komentáře

  • @summisahani6415
    @summisahani6415 Před 4 dny

    Great explaination. It was hard to find video with simple explanation. Finally found this. Keep posting.

  • @sourajitsahoo7731
    @sourajitsahoo7731 Před 8 dny

    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 ?

  • @mohamed_bouafif
    @mohamed_bouafif Před 15 dny

    thank you

  • @riddhimaheshwari1086
    @riddhimaheshwari1086 Před 21 dnem

    simplest and best explanation available !!

  • @udipto7547
    @udipto7547 Před měsícem

    I have some problems on compiler it shows me compile error

  • @user-cl3un2qx7s
    @user-cl3un2qx7s Před měsícem

    what this v vector ( 2D ) is storing

  • @nandanbhowmick1825
    @nandanbhowmick1825 Před 2 měsíci

    Great explanation of B. Thanks.

  • @mitalsarvaiya5549
    @mitalsarvaiya5549 Před 3 měsíci

    Please continue cfg problem of the day...

  • @jobair541
    @jobair541 Před 3 měsíci

    how can I format code in CP editor, In VS code its really easy ! Its looks really good after formatting the code !

  • @gnanaprakashm843
    @gnanaprakashm843 Před 3 měsíci

    Missing your potd videos !

  • @mitalsarvaiya5549
    @mitalsarvaiya5549 Před 3 měsíci

    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?

  • @akashagarwal4833
    @akashagarwal4833 Před 3 měsíci

    Amazing approach

  • @divyakhairha9190
    @divyakhairha9190 Před 4 měsíci

    Thanks ,was having a hard time with que B

  • @L_Yassine
    @L_Yassine Před 4 měsíci

    what s the logiciel u are using sir ?

  • @fahimx51
    @fahimx51 Před 5 měsíci

    what is your whiteboard name? please i need to know

  • @multiversesyndrome2299
    @multiversesyndrome2299 Před 5 měsíci

    sir please keep uploading contest solutions videos....great explanation....really helpful !!!

  • @subhanahuman7890
    @subhanahuman7890 Před 5 měsíci

    irritating animation on half of the screen. can't watch it

  • @phoddaal7130
    @phoddaal7130 Před 5 měsíci

    Thank u so much for clearing all my confusions 🤗

  • @sohamsolankii
    @sohamsolankii Před 5 měsíci

    how to add debug.h file for cpp in cp editor

  • @ronenfe
    @ronenfe Před 5 měsíci

    not clear what's k/(n-1)!

  • @yashsawalkar8493
    @yashsawalkar8493 Před 6 měsíci

    Miss your daily potd videos

  • @md.shazidalhasan6726
    @md.shazidalhasan6726 Před 6 měsíci

    did you left codefores? you are not doing any contest lately.

  • @motivationlines9461
    @motivationlines9461 Před 6 měsíci

    Sir podt ki videos kyu nhi aa rhi hai

  • @shankar1050
    @shankar1050 Před 6 měsíci

    bro when will you upload next potd video

  • @utsavaggrawal2697
    @utsavaggrawal2697 Před 6 měsíci

    great explanation

  • @sainithyamsani4062
    @sainithyamsani4062 Před 6 měsíci

    waiting for daily videos

  • @prathamasrani5608
    @prathamasrani5608 Před 6 měsíci

    bro video dalte jao yarr we are waiting

  • @KevinKSSetiawan
    @KevinKSSetiawan Před 6 měsíci

    is there any way to solve this using javascript with the same time complexity?

  • @prathamasrani5608
    @prathamasrani5608 Před 6 měsíci

    Great explanation

  • @prathamasrani5608
    @prathamasrani5608 Před 6 měsíci

    Great initiative for the Contest answers....

  • @354_rajput
    @354_rajput Před 6 měsíci

    Thanks you please continue daily

  • @rustamkumar1506
    @rustamkumar1506 Před 6 měsíci

    great explanation 😍😍😍

  • @dpworldzest4755
    @dpworldzest4755 Před 6 měsíci

    explanation is awesome ....❤❤

  • @hardikjain-brb
    @hardikjain-brb Před 6 měsíci

    nice

  • @architbajpai7267
    @architbajpai7267 Před 6 měsíci

    sir when will codeforces editorials come back 😭.

  • @shoaib5x718
    @shoaib5x718 Před 6 měsíci

    Thank you for uploading so early in the morning !

  • @Algorithmswithsubham
    @Algorithmswithsubham Před 6 měsíci

    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;

  • @susheelkumar291
    @susheelkumar291 Před 6 měsíci

    Great explanation

  • @Lucifer-spam
    @Lucifer-spam Před 6 měsíci

    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).

    • @shanidandanayak3806
      @shanidandanayak3806 Před 6 měsíci

      That example doesn’t satisfy the given condition that all edges must be visited.

  • @VivekYadav-uy9ts
    @VivekYadav-uy9ts Před 6 měsíci

    Good Explanation Bro! 🦾

  • @biswarupacharjya2258
    @biswarupacharjya2258 Před 6 měsíci

    Very Nice Logic Sir 💞💞💞💞💞💞

  • @Algorithmswithsubham
    @Algorithmswithsubham Před 6 měsíci

    Cf k editorials continue kijya

  • @shivamraj-xv3wt
    @shivamraj-xv3wt Před 6 měsíci

    it can be done using booyer moore's algorithm in O(1) space complexity instead of using a map

  • @mridulsehgal6783
    @mridulsehgal6783 Před 6 měsíci

    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 . 🙏🙏

  • @gaganjasuja1602
    @gaganjasuja1602 Před 7 měsíci

    Please make a video for todays leetcode contest question maximum palindromes after any operations

  • @user-eb4yb3go9y
    @user-eb4yb3go9y Před 7 měsíci

    which software you are using to explain the question?

  • @AmarjeetKumar-to9ub
    @AmarjeetKumar-to9ub Před 7 měsíci

    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); }

  • @prathamasrani5608
    @prathamasrani5608 Před 7 měsíci

    Nice explanation, can you please come with DP series

  • @junaidirshad614
    @junaidirshad614 Před 7 měsíci

    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]; } };

    • @ABHAYKUMAR-kt3ug
      @ABHAYKUMAR-kt3ug Před 7 měsíci

      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.

    • @ABHAYKUMAR-kt3ug
      @ABHAYKUMAR-kt3ug Před 7 měsíci

      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}}; };