Navigating the Path to DSA Mastery: Insights from Striver's A2Z DSA Sheet

Navigating the Path to DSA Mastery: Insights from Striver's A2Z DSA Sheet

Hey folks, I am Sayantan, a passionate learner and aspiring software engineer deeply committed to mastering the intricacies of DSA. With a background in computer science and an insatiable thirst for knowledge, I embarked on a journey to enhance my problem-solving abilities and solidify my grasp of fundamental DSA principles.

In the realm of competitive programming and algorithmic problem-solving, Striver, also known as Raj Vikramaditya, stands as a beacon of expertise and guidance. His comprehensive approach to teaching Data Structures and Algorithms (DSA) has garnered him a dedicated following among aspiring programmers worldwide. Central to his teaching methodology is the renowned Striver's A2Z DSA sheet, a structured curriculum meticulously crafted to enhance problem-solving skills and deepen understanding of DSA concepts.

Choosing to follow Striver's A2Z DSA sheet was a natural decision born out of a desire to learn from the best and leverage proven strategies to accelerate my learning journey. In a landscape saturated with myriad resources, Striver's sheet stood out for its clarity, depth, and emphasis on building a strong foundation in DSA.

Journey Overview:

My journey into DSA fundamentals was enriched by guidance from top educators, including Ankush Singla, the founder of Coding Ninjas, Raj Vikramaditya (aka Striver), Anuj Kumar Sharma (aka Anuj Bhaiya), and resources like GeeksForGeeks. Their insights and teachings provided me with a solid foundation upon which to build my problem-solving skills.

Over the past 1-1.5 months, I have dedicated myself to conquering the array portion of Striver's A2Z DSA sheet. This segment encompasses a comprehensive array of problems, ranging from easy to hard difficulty levels. Array is the most basic data structure and easy to learn, making it an ideal starting point for DSA problem-solving.

Problem-Solving Approach:

I endeavored to solve each problem independently, though I almost nailed every problem but I encountered instances where optimal solutions eluded me. The problem solving technique I followed and I think others should is

  • Give an at-least 30min for a easy problem, 45 min for medium and 1hour for a hard problem.

  • Always use pen and paper to solve a problem before directly start coding.

  • Don’t directly jump for optimal approach, try brute force first, then better and then optimal.

  • If a problem was not solved, first try to take hints, if still not solved then read the solution documentation. Even then if you can’t solve that, then you should watch the solution video.

  • Even if you solved the problem, you should watch the solution for a better or different approach.

Strategies for Success:

Despite encountering hurdles along the way, several strategies proved instrumental in navigating through the array problems effectively:

  • Meticulous Note-Taking: One of the most impactful strategies I adopted was maintaining a detailed notebook. For every problem I tackled, I diligently documented the algorithms, key insights, and solution approaches. This practice not only reinforced my understanding but also provided a valuable reference for future revisions.

  • Revising Notes Every day: Consistent revision of my notes became an integral part of my routine. By revisiting the algorithms and insights I had documented daily, I solidified my understanding and ensured that the knowledge stayed fresh in my mind.

  • Consistency is Key: Throughout the journey, maintaining consistency in my practice sessions proved to be crucial. Whether it was solving problems, revising notes, or seeking guidance, staying committed to my goals helped me steadily progress toward mastery.

Algorithms Learned:

Through my journey with Striver's A2Z DSA sheet, I gleaned invaluable insights from various problems. Here are some notable algorithmic approaches I encountered:

1. Problem: Longest Subarray with given sum k (Positives)

  • Approach: Two-pointer Technique

    • Employing two pointers to traverse the array allowed for an optimal solution while minimizing traversal complexity.

2. Problem: Sort an array of 0s, 1s and 2s.

  • Approach: Dutch National Flag Algorithm

    • Maintain three pointers and divide the array into 4 subportions where one contains only 0s, one contains 1s, one contains 2s and one is unsorted. Now we gradually decrease the unsorted ones by swapping elements.

3. Problem: Majority Element and Majority Element II.

  • Approach: Boyar-Moore's voting algorithm

    • Maintain count and current element and update them according to various conditions.

4. Problem: Maximum Subarray Sum.

  • Approach: Kadane's Algorithm

    • This dynamic programming technique proved instrumental in efficiently finding the maximum subarray sum within arrays.

5. Problem: Merge Two Sorted arrays (without using any extra space).

  • Approach: Shell Sort Algorithm

    • Maintain a gap value, update that and swap elements.

6. Problem: Find missing and repeating number.

  • Approach: XOR operation

    • Use XOR to find the rightmost differentiating bit of those two numbers and then find those applying XOR properties again.

7. Problem: Number of Inversions and Reverse Pairs.

  • Approach: Merge Sort Algorithm

    • Use merge sort's merge function to find the positions of the elements and keep a count.

Also learned the effective use of Hashmap to solve Subarray related, Two sum and similar problems, math and bitwise-XOR to solve some problems and most of all solving problems based on observations only like Next Permutation, Rotate array etc.

Code Repository:

Recognizing the importance of documentation and knowledge sharing, I meticulously documented all solution codes, along with detailed explanations of the approaches employed, in a dedicated GitHub repository. This repository serves as a comprehensive resource for fellow learners, providing insights into problem-solving strategies and algorithmic techniques. Click Here to see the repository.

Quantifying Progress: A Motivational Milestone

In addition to these strategies, I'm proud to share that by following this sheet, I have successfully completed over 35 problems on LeetCode and more than 50 problems on Coding Ninjas. While I understand that number of problems solved don't determine success, they serve as a motivational milestone, fueling my determination to push even further beyond my current achievements.

Next Steps: Mastery Through Practice:

Armed with newfound knowledge and fortified by past experiences, I now set my sights on the next challenge: mastering `Binary search` problems. With unwavering determination and a commitment to continuous learning, I embark on this journey with the assurance that each problem solved brings me closer to mastery.

Conclusion:

The journey through Striver's A2Z DSA sheet's array portion has been both enlightening and empowering. It has reinforced the importance of perseverance, strategic learning, and the value of collaborative knowledge sharing. As I continue my quest for DSA mastery, I remain grateful for the challenges faced, the lessons learned, and the opportunities for growth that lie ahead.

Stay tuned for further updates on my journey through the world of Data Structures and Algorithms!