CF Step
CF Step
  • 29
  • 27 161
The interview ft. LeetCode | LC 3321. Find X-Sum of All K-Long Subarrays II
Code and Slides cfstep.com/leetcode/problems/problem-3321/
Editorial for fourth problem of LeetCode Weekly Contest 419 Find X-Sum of All K-Long Subarrays II
Median in a Stream of Integers
Min Heap, Max Heap
Sliding Window
Sets in C++
LeetCode Algorithms
Top K elements in stream
มุมมอง: 572

วีดีโอ

Dynamic Programming for Leetcode | Leetcode 3320 Count The Number of Winning Sequences
มุมมอง 4062 หลายเดือนก่อน
Slides and Code cfstep.com/leetcode/problems/problem-3320/ Editorial for Leetcode 3320 Count The Number of Winning Sequences which appeared as the third problem in LeetCode Weekly Contest 419. This is a hard level problem. Dynamic Programming Recursion Memoization Tabulation Iterative DP Negative Indices Optimization Subset Enumeration Rock Paper Scissors DP
Fractional Greedy with a Twist ft. Atcoder ABC374E Sensor Optimization Dilemma 2
มุมมอง 3543 หลายเดือนก่อน
cfstep.com/atcoder/contests/abc-374/problem-e/ Editorial for Problem E Sensor Optimization Dilemma 2 from Atcoder Beginner Contest 374 KEYENCE Programming Contest 2024 Greedy Algorithms Dynamic Programming Full Search
How to optimize Codeforces problems ft. Atcoder Library : CF2019D Speedbreaker
มุมมอง 1.6K3 หลายเดือนก่อน
Slides, Code, Practice Problems : cfstep.com/codeforces/contests/contest-2019/problem-d/ Editorial for problem D. Speedbreaker from Codeforces Round 975 (Div. 2) with code CF2019D. It is same as problem B. Speedbreaker from Codeforces Round 975 (Div. 1) with Code CF2018B Atcoder Library Lazy Segment Tree Prefix Sums Dynamic Programming
Contribution Technique on Trees ft. CF2007E : Iris and the Tree
มุมมอง 8764 หลายเดือนก่อน
Read this blog after watching the video : cfstep.com/training/tutorials/general-techniques/contribution-technique-on-trees/ Code, Slides, Practice Contest cfstep.com/codeforces/contests/contest-2007/problem-e/ Editorial for Problem E. Iris and the Tree from Codeforces Round 969 (Div. 2) and B. Iris and the Tree from Codeforces Round 969 (Div. 1) CF2007E CF2006B Contribution Technique Tree DP Op...
Game Theory on Trees : ft. Codeforces CF2007D Iris and Game on the Tree
มุมมอง 9104 หลายเดือนก่อน
Editorial for problem D. Iris and Game on the Tree from Codeforces Round 969 (Div. 2) and A. Iris and Game on the Tree from Codeforces Round 969 (Div. 1) Problem Code CF2007D and CF2006A Game Theory Trees Alice and Bob Optimal Strategy Mirroring in Game Theory Codeforces upsolving
Improve Problem Solving Skill on Codechef : CC Reflection ft. Starters 149 Kill Monsters
มุมมอง 2994 หลายเดือนก่อน
Editorial of Kill Monsters (Easy Version) and Kill Monsters (Hard Version) from Codechef Starters 149 Problem Code CXZ and MMA Lower Bound, C STL, Prefix Sums, Suffix Sums, Binary Search Competitive Programming
Dynamic Programming Mindset for Codeforces ft. CF2003F
มุมมอง 2.2K4 หลายเดือนก่อน
Dynamic Programming Patterns for Codeforces Editorial for F. Turtle and Three Sequences from Codeforces Round 968 (Div. 2) Problem code CF 2003 F Longest Increasing Subsequence Longest Increasing Subsequence with Maximum Increasing Subsequence of length k with Maximum Sum Increasing Subsequence of length k with Maximum Sum and no identical Colors
CF Reflection : Improve Problem Solving Skill on Codeforces ft. CF2003D1 and CF2003D2
มุมมอง 1.1K4 หลายเดือนก่อน
Editorial for problem D1. Turtle and a MEX Problem (Easy Version) and D2. Turtle and a MEX Problem (Hard Version) from Codeforces Round 968 (Div. 2) Contest Code 2003 Ideas used : Minimum Excludant (Mex), Directed Acyclic Graphs (DAG), Toplogical Sorting, DP on DAG, Graph Modelling
The world of Data Structures and Subsequences ft. Codeforces CF2001D Longest Max Min Subsequence
มุมมอง 6284 หลายเดือนก่อน
Editorial for Problem D Longest Max Min Subsequence from Codeforces Codeforces Round 967 (Div. 2) Problem Code 2001 D LeetCode 1081. Smallest Subsequence of Distinct Characters Kattis Early Orders Subsequences Greedy Algorithms Set Map Vector Deque Segment Tree Stack Binary Search Greedy Algorithms Exchange Argument Next Greater Element Heaps Lazy Segment Tree
Graph Modelling with Stacks ft. E. Cosmic Rays Codeforces CF2002E
มุมมอง 5125 หลายเดือนก่อน
Editorial for Problem E Cosmic Rays from EPIC Institute of Technology Round August 2024 (Div. 1 Div. 2) Problem Code CF 2002E Monotonic Stack Graph Prefix DP Graph Modelling Optimization
The big idea behind Tree Diameter
มุมมอง 9545 หลายเดือนก่อน
CSES Tree Diameter CSES Tree Distances 1 Codeforces Three Paths on a Tree
The road to success is paved by failure : Codeforces D : Maximize the Root Edu 168 Editorial
มุมมอง 5625 หลายเดือนก่อน
Editorial of problem D Maximize the Root from Codeforces Educational Round 168 (Div 2) Problem Code 1997D How to be successful at Codeforces and Competitive Programming.
How to find Xor of all numbers from 1 to N and the number of set bits at any position?
มุมมอง 5525 หลายเดือนก่อน
Xor of numbers in a given range Number of set bits from L to R
How to solve Codeforces problems using Atcoder Library ft. Div3 1996G Penacony
มุมมอง 1.4K5 หลายเดือนก่อน
Best way to read editorials and upsolve problems on Codeforces Codeforces Round 962 Div 3 Editorial Problem 1996 G Penacony
The Big idea behind SOS DP ft. Editorial of 1995D : Cases Codeforces
มุมมอง 1.3K5 หลายเดือนก่อน
The Big idea behind SOS DP ft. Editorial of 1995D : Cases Codeforces
Replace Mono stack with Sets + Contribution Technique ft. Codeforces 1988E Range Minimum Sum
มุมมอง 5805 หลายเดือนก่อน
Replace Mono stack with Sets Contribution Technique ft. Codeforces 1988E Range Minimum Sum
Time Complexity of Tree DP : The Omnipotent Monster Killer Codeforces Round 958 Editorial
มุมมอง 1.1K5 หลายเดือนก่อน
Time Complexity of Tree DP : The Omnipotent Monster Killer Codeforces Round 958 Editorial
ChatGPT can't solve this Codeforces puzzle. Can you? ft. @aryanc403
มุมมอง 9168 หลายเดือนก่อน
ChatGPT can't solve this Codeforces puzzle. Can you? ft. @aryanc403
How to solve scary Codeforces problems : Div 3 H The Most Reckless Defense Editorial
มุมมอง 8139 หลายเดือนก่อน
How to solve scary Codeforces problems : Div 3 H The Most Reckless Defense Editorial
Train of Thoughts : How to think about Codeforces Problems (ft. CF1942D)
มุมมอง 9559 หลายเดือนก่อน
Train of Thoughts : How to think about Codeforces Problems (ft. CF1942D)
D. Birthday Gift in 5 Easy Steps : Codeforces Round 936 Divison 2
มุมมอง 1.2K9 หลายเดือนก่อน
D. Birthday Gift in 5 Easy Steps : Codeforces Round 936 Divison 2
D. Non Palindromic Substrings in 10 Easy Steps : Codeforces Round 934 Divison 2
มุมมอง 1K9 หลายเดือนก่อน
D. Non Palindromic Substrings in 10 Easy Steps : Codeforces Round 934 Divison 2
Editorial for Codeforces Edu Round 162 E : Count Paths (DP on Trees)
มุมมอง 98810 หลายเดือนก่อน
Editorial for Codeforces Edu Round 162 E : Count Paths (DP on Trees)
G. Vlad and Trouble at MIT from Codeforces Round 928 (Div. 4) Tree DP
มุมมอง 89510 หลายเดือนก่อน
G. Vlad and Trouble at MIT from Codeforces Round 928 (Div. 4) Tree DP
ABC 335F : Hop Sugoroku : Distributing DP and SQRT Trick
มุมมอง 517ปีที่แล้ว
ABC 335F : Hop Sugoroku : Distributing DP and SQRT Trick
Optimizing DP with Sliding Window : Atcoder Beginner Contest 334 F : Christmas Present 2
มุมมอง 690ปีที่แล้ว
Optimizing DP with Sliding Window : Atcoder Beginner Contest 334 F : Christmas Present 2
Optimizing DP with Monotonic Stacks : Codeforces Educational Round 160D : Array Collapse
มุมมอง 2.9Kปีที่แล้ว
Optimizing DP with Monotonic Stacks : Codeforces Educational Round 160D : Array Collapse
Cycles in Probability DP : Atcoder ABC333F - Bomb Game 2
มุมมอง 481ปีที่แล้ว
Cycles in Probability DP : Atcoder ABC333F - Bomb Game 2

ความคิดเห็น

  • @juswanth.t133
    @juswanth.t133 7 วันที่ผ่านมา

    Loved it

  • @snider16661
    @snider16661 หลายเดือนก่อน

    keep doing this. Great explanation.

  • @yyooz
    @yyooz หลายเดือนก่อน

    Hello sir! Just want to say that the videos on your channel are the best among other creators on TH-cam! This channel is so underrated, but I hope it will gain the recognition it deserves one day. The explanations are so easy to understand and very intuitive and detailed. I have been enjoying the series until now and can't wait for the next video. Will wholeheartedly support this great channel!

    • @cfstepofficial
      @cfstepofficial หลายเดือนก่อน

      Thank you for taking out the time to write this comment. Appreciate it. I haven't been consistent on the channel, but I'll try to.

    • @yyooz
      @yyooz หลายเดือนก่อน

      @@cfstepofficial Thank you so much sir!! :DD I just want to leave a word because I genuinely believe this channel deserves a lot of attention! It's okay, but I will treasure every video that has been made :)

  • @Code_Note
    @Code_Note หลายเดือนก่อน

    I think I am unable to see solutions of other users in the standings page for the contest page attached in the comment. Since its a part of gym section, solutions become visible post solving the question. But I have solved the problem but still unable to see others' solution.

    • @cfstepofficial
      @cfstepofficial หลายเดือนก่อน

      It was intentionally disabled. I've now enabled it for people who've solved it.

    • @Code_Note
      @Code_Note หลายเดือนก่อน

      @cfstepofficial thanku

  • @kenji1226h
    @kenji1226h 2 หลายเดือนก่อน

    Your explanation is amazing! Please keep updating more codeforces videos!

  • @jd3287
    @jd3287 2 หลายเดือนก่อน

    good visuals, great English narration!! -would the run time be like 3 * 2^n cause its 3 options to start but then you cant repeat what you picked last round if we were talking about the time complexity for the real problem? at 3:36 -also first time hearing about equivalence classes, seems like its related to equivalence relations. this idea you could explain better i think. thank you.

    • @cfstepofficial
      @cfstepofficial 2 หลายเดือนก่อน

      Suppose T(n) denotes the work done for n rounds. Then, T(n + 1) = 3*T(n). (because for each element in T(n) subset, you can check the last move played in O(1)). Therefore, the time complexity of the naive approach is 3^n. Equivalence relations is a pretty standard concept, didn't want to dive deep into it, otherwise it'd have made the video longer. Maybe some day I'll add more details in a separate video.

  • @srprantor
    @srprantor 2 หลายเดือนก่อน

    I'm gonna go and learn Binary search first 🙂

  • @aymanalali8983
    @aymanalali8983 2 หลายเดือนก่อน

    keep going ❤❤👨‍💻👨‍💻👨‍💻👨‍💻

  • @yassinmohamed7240
    @yassinmohamed7240 2 หลายเดือนก่อน

    can you recommmend similar problems ?

    • @cfstepofficial
      @cfstepofficial 2 หลายเดือนก่อน

      LC295. Find Median from Data Stream LC480. Sliding Window Median LC1825. Finding MK Average LC2102. Sequentially Ordinal Rank Tracker

    • @yassinmohamed7240
      @yassinmohamed7240 2 หลายเดือนก่อน

      @@cfstepofficial thanks alot

  • @darshanrajpattanaik2154
    @darshanrajpattanaik2154 2 หลายเดือนก่อน

    What tool you use to showcase your code in a styled manner?

    • @cfstepofficial
      @cfstepofficial 2 หลายเดือนก่อน

      10015.io/tools/code-to-image-converter

  • @powerwithin9212
    @powerwithin9212 2 หลายเดือนก่อน

    Thank You! And this was awesome.

  • @treelibrarian7618
    @treelibrarian7618 2 หลายเดือนก่อน

    Although your optimisations are interesting, I believe your solution is not optimal, mainly due to your approach to solving. But it was a very interesting problem to analyse. That said, I'm only 99% certain my analysis of the problem is correct, so if anyone can present to me a counterexample to the theory that *IF THE PROBLEM IS SOLVABLE, THEN ALL STARTING POINTS BETWEEN THE LIMITS THAT CAN REACH THE FURTHER ENDS ARE VALID STARTING POINTS*, please do and I will retract my solution. If one considers the problem working in from the edges, a simple and quick (O(N)) method using a stack can be found. The length of the array (n) is also the maximum permitted value within it. We start our index (i) from the left edge with a countdown (cd) that starts at n. At each count, if the the deadline at i is less than c, we push that c onto the stack. otherwise we progress to the next i. This progresses till the countdown reaches 0, at which point we have the index of the furthest starting point from the left edge that can still reach the left edge, and also a stack containing the move-numbers not used by getting to the left edge while leaving each step to the left to the last possible moment. We can now prove the puzzle possible by continuing from i and checking that at each step the deadline is equal or later than the next available move-number from the stack. Proving the puzzle is possible from the left also proves it from the right because it proves the true success condition: that there are no subsets of the array where the subset has a deadline earlier than the width of the subset at both its ends. This analysis can also lead to a 2-pointer solution (see below) but I don't like 2-pointer solutions since they lead to poor data-streaming, often require conditional code sections (lots of branch misspredicts), etc. To determine the range of possible starting-points we now just need to perform a simplified version of the first loop (without the stacking) to determine the leftmost starting-point that can still reach the right end. the number of possible solutions is the range including these two limits. this solution is O(N) time with a stack usage of O(N) for the proof of solvability. int solve(int *dl, int n) // note: I'm writing in pure C { if((dl[0] < len) && (dl[n-1] < len) return 0; // definitely impossible int stack[n]; // definitely enough space int i = 0, stp = 0; // index, stackpointer for(int cd = len; cd > 0; --cd) { // build stack. starting from len means that the other end will always be reached in unwinding if it is possible. stack[stp] = cd; // all unused moves when left-end deadlines are met at the last possible moment are put on the stack stp += (dl[i] < cd); // move-number pushed to stack if deadline is missed at this move-number (write always, increment conditional) i += (dl[i] >= cd); // but if deadline was met, move on to the next deadline } int rl = i; // rl remains as our right-most limit for starting points. is actually one-past, but that works out for the math. // every remaining deadline should be met by the available moves if any solution is possible while(--stp >= 0) if(dl[i++] < stack[stp]) return 0; // so a failure here means there are no possible solutions // before this loop i + stp == n, so reaching bottom of stack is equal to reaching end of array int ll = n; for(int cd = len; cd > 0; --cd) // finding leftmost starting point that can reach the right end is simpler since we don't need to complete the proof twice if(cd > dl[--ll]) cd = dl[ll]; // meaning we don't need to build a stack, so we can just drop the count when the deadline is lower return rl - ll; // rl ends one beyond the limit, ll ends at the limit, so returned number is correct. } although it will be somewhat dependent on the compilers ability to find the branchless optimisations that are possible (clang will, gcc wont), this should be able to find a range of 10000 possible solutions in the maximal array of 100000 deadlines in about 130µs. ************************************************** As mentioned, there is also a *TWO POINTER* solution, based on the same theory, which uses no auxilliary array (and each element of the given array is read only once too), athough due to the dynamics of the two-pointer code, the runtime is 80% longer than the stack version above. In order to prove the solution possible we can use the property described above that *NO SUB-RANGE CAN BE LONGER THAN THE VALUE AT BOTH ITS ENDS*. One end being less is OK, but not both. Using two pointers we can shrink a range while examining its end-values in such a way that the maximal range with the minimal end-values will always be found, by just moving inward the higher end each step (if equal I move in the left end, but that is arbitrary). While doing this we can also determine the limits of the starting range by casting shadows. If one envisions the problem space as the roof of a cave hanging low in the middle, then the limits of where we can start from will be defined by the shadows cast by a diagonal parallel light source shining from each end. The shadow is defined by the lowest hanging protrusion accross that diagonal surface, and the range we can start from is the range where we can see both lights. The "shadow" of each deadline is just it's position +- it's height, and we can use max/min to track the furthest shadow from each direction. It should be noted that it is possible to see both lights (limits overlap) yet the solution is still impossible, so both the proof and the limits must be calculated. int solve(int *dl, int len) // a 2-pointer method { int lp = 0; rp = len-1; // left pointer and right pointer start at first and last element int lsl = len, rsl = -1; // these are the "shadow limits". They define the furthest point that 45° light would reach from the lowest hanging deadline. while(lp <= rp) { // until the pointers pass each other int l = dl[lp]; // read the range end values int r = dl[rp]; int w = (rp - lp); // this "width" only includes one end, so compare to w+1 by using <= instead of < if((l <= w) & (r <= w)) return 0; // no solutions possible if both l and r are less than w+1. single & forces compiler to combine the conditions before branch int rps = rp - r; // shadow cast by the right position deadline if(rsl < rps) rsl = rps; // keep if it moves the right shadow limit further right int lps = lp + l; // shadow cast by the left position deadline if(lsl > lps) lsl = lps; // keep if it mofes the left shadow limit further left lp += (l >= r); // move inward the pointer with the greater value rp -= (l < r); // scanning like this finds the minimum deadlines with the maximum width, will find failing ranges for sure. } // reaching the end of this loop means the puzzle is solvable. The left and right shadow limits define the range of starting points that can work. return (lsl - rsl) - 1; // the shadow calculations end up one greater than we want in both directions } I'm not sure even clang can work out it needs to combine the two if() conditions in the failure test into a single branch to avoid lots of misspredicts, indeed I believe it is bound by the rules of the language not to (conditions beyond a failed && must not get processed), so I directed it to do so by combining the values of the tests with & instead of combining the logic with &&. This algorithm can complete a similar maximal 100000 entry puzzle in about 230µs.

  • @mave882
    @mave882 3 หลายเดือนก่อน

    please continue making videos like this also apart from codeforces content as always your explanation is lit! thanks

  • @mmmnmmmmmmmm
    @mmmnmmmmmmmm 3 หลายเดือนก่อน

    What CF rating could this problem be?

    • @zaid6527
      @zaid6527 3 หลายเดือนก่อน

      1600 or 1700

    • @cfstepofficial
      @cfstepofficial 3 หลายเดือนก่อน

      1600.

    • @mmmnmmmmmmmm
      @mmmnmmmmmmmm 3 หลายเดือนก่อน

      Thanks guys.

  • @Randomuser7890
    @Randomuser7890 3 หลายเดือนก่อน

    also , this is a copy of atcoder problem

  • @physicsstudent8484
    @physicsstudent8484 3 หลายเดือนก่อน

    great explaination

  • @Anonymous____________A721
    @Anonymous____________A721 3 หลายเดือนก่อน

    Bro pls make a video on how to get skill =10% of urs 😅

  • @Anonymous____________A721
    @Anonymous____________A721 3 หลายเดือนก่อน

    Goddddddd

  • @mmmnmmmmmmmm
    @mmmnmmmmmmmm 3 หลายเดือนก่อน

    Thanks a lot

  • @Bharat_Rider
    @Bharat_Rider 3 หลายเดือนก่อน

    Best video possible 🔥

  • @whoamitotheworld4567
    @whoamitotheworld4567 3 หลายเดือนก่อน

    do u mean dfs and memoization when you talk about tree dp?

  • @studyplanet4656
    @studyplanet4656 3 หลายเดือนก่อน

    Once a legend , always a legend . Keep it up bro 👍👍

  • @mz-dk8gf
    @mz-dk8gf 3 หลายเดือนก่อน

    Thanks bro I was struggling to understand why Jangly first used less efficient machines and only upto 100 for producing machines you cleared both the daughts

  • @EthanHunt-z8r
    @EthanHunt-z8r 3 หลายเดือนก่อน

    Bro you explain it very well

  • @dharmilshah155
    @dharmilshah155 3 หลายเดือนก่อน

    Bro need more videos like this 😇

  • @yunogasai_uwu4648
    @yunogasai_uwu4648 3 หลายเดือนก่อน

    Great work

  • @adityavinchhi9339
    @adityavinchhi9339 3 หลายเดือนก่อน

    Your slow speaking speed help to process the logic in one go, elsewhere i need to pause the video again and again to intuition of what does the speaker said. Thank you :)

  • @its385
    @its385 3 หลายเดือนก่อน

    og is back

  • @untitledman1457
    @untitledman1457 3 หลายเดือนก่อน

    GODLY

  • @jeevan-23
    @jeevan-23 3 หลายเดือนก่อน

    The video was great as usual

  • @SNX03
    @SNX03 3 หลายเดือนก่อน

    The GOAT has returned O7

  • @whoamitotheworld4567
    @whoamitotheworld4567 3 หลายเดือนก่อน

    you are missing one thing here that we need to multiply odd index by 1 so need to pick max when at odd index

    • @cfstepofficial
      @cfstepofficial 3 หลายเดือนก่อน

      I haven't discussed that problem in the video. I have discussed an easy version that I created in my Codeforces group which asks you to print lexicographically minimal subsequence. This was specifically done to avoid adding addition complexity with alternating min-max. The alternating one is left as an exercise for the reader.

  • @Lakshya-f4l
    @Lakshya-f4l 3 หลายเดือนก่อน

    Explained well. Impressive slides.

  • @GateDA-omkarpunjaji
    @GateDA-omkarpunjaji 4 หลายเดือนก่อน

    Add monotonic stacks standard problems . NeXT nearest greater ,nest nearest smaller histogram etc

  • @utsavaggrawal2697
    @utsavaggrawal2697 4 หลายเดือนก่อน

    Great explanation, the amount of effort you put in for the video and the website is commendable!!

  • @kusumakhter6420
    @kusumakhter6420 4 หลายเดือนก่อน

    Please don’t stop this CC Reflection series. Nowadays CC problems are so good <3

  • @yagnikdhameliya6332
    @yagnikdhameliya6332 4 หลายเดือนก่อน

    Answer to last question: For each edge (i, par[i]) it's contribution will be (subtree(i) * (n - subtree(i))). Do add this much for all edges to answer. Multiply weight of the edge for weighted graph.

    • @cfstepofficial
      @cfstepofficial 4 หลายเดือนก่อน

      Yep, that's correct.

  • @yagnikdhameliya6332
    @yagnikdhameliya6332 4 หลายเดือนก่อน

    I think some variables are not required. unlocked_sum and locked_sum are not required only one variable sum will be sufficient. Below assigned[v]+=w only do sum+=w and remove unblocked_sum and locked_sum from everywhere. At time of events your answer would be ans=sum+unlocked_count*remain Why? Because see brute force you will notice you need sum of all node's assigned[i] value and assigned [i] value is just some of w's. So, the "sum" is doing the same thing. Keep everything else same. Please correct me if i am wrong anywhere. Btw your explanations are too good keep it up.

  • @kusumakhter6420
    @kusumakhter6420 4 หลายเดือนก่อน

    Your explanation is so good 💛 Please upload video regularly.

  • @mazenmohamed530
    @mazenmohamed530 4 หลายเดือนก่อน

    Thank for your video, but modify the title and describtion, it is Educational Codeforces Round 168 (Rated for Div. 2) not 158

    • @cfstepofficial
      @cfstepofficial 4 หลายเดือนก่อน

      Good catch. Fixed.

  • @GateDA-omkarpunjaji
    @GateDA-omkarpunjaji 4 หลายเดือนก่อน

    Do some dry run on some test cases with how data is manipulate in data structures and how algorithms flows goes on .. this will very beneficial for us .. love ur unique and very intresting containts ❤❤

  • @anupamkasturia3821
    @anupamkasturia3821 4 หลายเดือนก่อน

    Was able to solve the weighted part completey myself after fully understanding contribution technique ....great video man..please keep uploading..

  • @SAUMYAGAUR-i5v
    @SAUMYAGAUR-i5v 4 หลายเดือนก่อน

    I am not sure about he sliding window of size K idea should it be every window of size k must have at least one element and the last element should also be a check point because in the examples we have a example AAB and c = 2 k = 2 so A will satisfy the condition of sliding windows and give the answer as 1 but on the contrary the example gives the solution to be 2. I modified your code and added the condition for the last element to be present and the code worked but without that code it isn't working.

    • @cfstepofficial
      @cfstepofficial 4 หลายเดือนก่อน

      Yes, what you are thinking is correct. Each sliding window of size k should have at least one checkpoint and the last element should also be a checkpoint. This is because no matter how you cut the string, the last character will have to be used. For your example, AAB, the ony cuts are A|AB and AA|B. In both cases, you use 2 unique ending characters, so answer cannot be 1. In the video, I have already mentioned this fact at 18:10

  • @studyplanet4656
    @studyplanet4656 4 หลายเดือนก่อน

    Bro i really liked your approach for problem solving please continue this series , very help full for competitive coders specially for higher ones .

  • @astroflexx82
    @astroflexx82 4 หลายเดือนก่อน

    dude this channel is a gold mine! your explanations are fantastic!

  • @anupamkasturia3821
    @anupamkasturia3821 4 หลายเดือนก่อน

    02:22, i guess at here in special dfs tree, for the current node x, if it is a leaf node, dis(x,x+ 1) would not be 1.. to find x + 1, we can keep going to the parent until we find a parent with sub_max_node[parent] > x.. great explanation man..

  • @ayushsrinivas
    @ayushsrinivas 4 หลายเดือนก่อน

    good slides

  • @darkhunter882
    @darkhunter882 4 หลายเดือนก่อน

    Really a good explanation and refreshing one in the plethora of content. Thanks for the explanation, appreciate it

  • @DSASolutions
    @DSASolutions 4 หลายเดือนก่อน

    Helpfull

    • @cfstepofficial
      @cfstepofficial 4 หลายเดือนก่อน

      Thanks. You have some good content on your channel as well. Keep it up!

    • @DSASolutions
      @DSASolutions 4 หลายเดือนก่อน

      @@cfstepofficial Thank You

  • @aymanalali8983
    @aymanalali8983 4 หลายเดือนก่อน

    understood 👍🏻♥️