Hello Everyone!
Week 12 began with tasks focused on Hash Maps, Sets, and String Manipulations. Today’s challenges tested my ability to manage structured data effectively while solving problems rooted in symmetry and string transformations. It was a rewarding start, balancing logical thinking with precision.
How the Day Played Out
-
Equal Row and Column Pairs (Medium Difficulty)
- Count the number of pairs where rows and columns in a grid are identical.
-
The Strategy:
- Used a hash map to store the frequency of rows represented as tuples.
- Transposed columns into tuples and checked their frequency in the hash map to count matching pairs.
-
The Fun Part:
- Identifying and matching symmetrical patterns in the grid felt like solving a visual puzzle!
-
Removing Stars From a String (Medium Difficulty)
- Remove characters from a string based on the occurrence of
*
, which erases the previous character. -
The Strategy:
- Used a stack to process the string.
- For each character, either pushed it onto the stack or popped the last character if a
*
was encountered.
-
The Fun Part:
- Watching the string dynamically transform as stars removed characters was satisfying—it felt like editing text in real-time.
- Remove characters from a string based on the occurrence of
What Made Today Special
-
Patterns and Symmetry:
- The grid-based logic in Equal Row and Column Pairs highlighted the elegance of identifying and leveraging symmetry in structured data.
-
Stack Dynamics:
- Removing Stars From a String demonstrated how stacks can simplify seemingly complex string manipulation tasks.
-
Data Structures in Action:
- Both problems emphasized the importance of choosing the right data structure (hash maps and stacks) to solve problems efficiently.
Key Takeaways
-
Hash Maps for Symmetry:
- Problems like Equal Row and Column Pairs show how hash maps efficiently track and compare structured data for patterns.
-
Stacks Simplify Reversals and Edits:
- Removing Stars From a String highlighted the power of stacks in managing reversals and sequential edits dynamically.
-
Break Problems into Logical Steps:
- Both tasks benefited from a step-by-step approach, ensuring clarity and precision in implementation.
Reflections
The Equal Row and Column Pairs problem was a rewarding exercise in finding patterns and managing symmetry, while Removing Stars From a String showcased the power of stack-based solutions for dynamic transformations. Together, these tasks reinforced the importance of combining logical problem-solving with efficient data structures.
What’s Next?
Tomorrow, I’ll focus on Stack Problems, tackling Decode String and Asteroid Collision. These tasks will challenge my ability to manage nested operations and sequential dynamics.
Thank you for following along! Let’s keep solving, learning, and growing together.
Top comments (0)