r/LeetcodeDesi • • 14h ago

Confused about how to properly follow Striver's A2Z sheet. Need some advice

4 Upvotes

Hey guys, I'm planning to start Striver's A2Z DSA sheet, but I'm a bit confused about how I should actually approach it.

I have a few questions, especially for people who have already completed the sheet or are currently following it.

  1. How should I approach each question?

For example, should I open the first question, try solving it myself for 30 minutes, then look at a hint if I'm stuck and try for another 10 minutes? And if I still can't figure it out, should I just look at the solution?

Or should I first learn the important algorithms and techniques related to a topic (like Kadane's algorithm, Dutch National Flag, etc.) and then start solving questions from that topic?

I'm confused about whether I should learn the concepts beforehand or discover them while solving problems.

2. How much time should I spend on a question?

Should I give easy, medium and hard questions different time limits? If yes, what would be a reasonable amount of time for each?

3. After finishing one topic, what should I do next?

Let's say I finish the Arrays section. Should I directly move to Binary Search in the A2Z sheet, or should I solve some more Array problems on LeetCode before moving on?

I don't want to move ahead just for the sake of completing the sheet and then forget everything I learned.

4. How long should it ideally take to complete the entire sheet?

I'm also managing college, so I want to set a realistic target. How many months would be reasonable?

5. Any other tips?

If you've completed the sheet, is there anything you wish you had known before starting? Any common mistakes I should avoid?

I want to actually get good at solving problems on my own rather than just watching solutions and completing the sheet.

Would really appreciate your suggestions!

Use gpt since if i write on my own everybody will confuse including me


r/LeetcodeDesi • • 8h ago

I have a Amazon SDE 2 onsite interview coming up.

3 Upvotes

Can anyone who has attended guide me on the difficulty level and what questions were asked?


r/LeetcodeDesi • • 18h ago

Q424 longest repeating character replacement -- doubt ?

1 Upvotes

this is solution i have doubt that in oficial code they do not update the max_freq inside the second while like changing the max_freq while shriking does not matter means you do not required to update that its like the max_freq hold the record of the highest freq of overall of till now array not the actual max_freq of the curr window

i am so confused why is this and why does it not break the code

i chatgpt it but i could not understand it throws some math , i want an actual logical answer why we do this

class Solution {
public:
    int characterReplacement(string s, int k) {
        int result = 0 ; 
        int freq[256] = {};
        int max_freq = 0 ;
        int left = 0 ;
        int right = 0 ;


        while(right < s.length()){
            freq[s[right]]++;


            for(int i = 0 ; i < 256 ;i++){
                max_freq = max(max_freq,freq[i]);
            }


            while((right - left + 1)- max_freq > k){
                freq[s[left]]--;
                left++;
                for(int i = 0 ; i < 256;i++){
                max_freq = max(max_freq,freq[i]);
            }



            }
            result = max(result,right-left+1);


            right++;


        }


        return result ;
        
    }
};