My 10-Week DSA Journey! đź“š
Week 3: Stacks and Queues
Journal Entry — Day 2
Today’s Tasks:-
- Easy: Valid Parentheses
- Medium: Daily Temperatures
- Medium: Evaluate Reverse Polish Notation
- Hard: Largest Rectangle in Histogram
- Hard: Sliding Window Maximum
Progress and Reflections:
Today, I continued deepening my understanding in stacks and queues: reviewing some problems and giving it new, more challenging ones. Each problem I solved made me think about how these data structures can be applied to solve the most complex tasks efficiently.
Valid Parentheses: It was a good problem with which to start the day, and a good reinforcement in my performing stack operations. The simplicity in using a stack to check whether parentheses are balanced reminded me of how such stack operations can be applied in more complex problems. 🧩
Daily Temperatures: That problem gave me further opportunity to make more efficient the stack-based solution so that it may have a better run over the large dataset. Further solidified the concept of using a stack for solving real-world problems where the dataset is sequential in nature. 🌡️
Evaluate Reverse Polish Notation: This problem continued the great exercise of stack management. The challenging part was to maintain the stack properly while evaluating these expressions. I think that is where the repetition helped internalize those concepts and improved my speed and accuracy in solving such problems. 🔢
Largest Rectangle in Histogram: This one was once again a tough challenge. However, having a better insight into the stack-based solution, I tried to attempt it with much more confidence. The problem itself made me realize pretty strongly how planning and execution must be done with care regarding tricky data structures like a stack.🏛️
Sliding Window Maximum: This, for the new day, hard problem involved the use of a deque to track maximum values efficiently within a sliding window. This problem was a good example of how queues can be applied in scenarios requiring dynamic range queries. Carefully managing the deque to keep track of the maximum was challenging yet rewarding.🔲
Reflection:
Today’s problems made me go back and enhance previous solutions, but at the same time, it introduced me to new challenges that tested my understanding of queues. Understanding in-depth how stacks and queues work with each other in different contexts helped me understand the versatility and power of such a combination. Each problem solved added a layer, building a strong foundation for the more complex tasks ahead.
Personal Improvement:
This, of course, is a process to further develop with more practice, but with more efficiency and the important differentiation of knowing when to use stacks versus queues. That intuition will surely be developed more as time goes on and many more problems get attempted. More challenges, more learning and growing opportunities.
Here’s to another successful day! Onward to more learning and accomplishments! 🚀