Thoughts, notes, and explanations on Python, Data Structures, Algorithms, Machine Learning, and learning how to learn effectively.
This section will grow over time with structured posts and practical insights.
Thoughts, notes, and explanations on Python, Data Structures, Algorithms, Machine Learning, and learning how to learn effectively.
This section will grow over time with structured posts and practical insights.
Regular Expressions in Python Pattern Matching, Text Processing, and the re Module Before We Begin – Why Regular Expressions Matter Here is a real problem. You have a CSV file with 50,000 rows of customer data. The phone number column is a mess: +91-9876543210 9876 543 210 (091) 9876-543210 91-98765-43210 9876543210 +919876543210 All of these are the same phone number in different formats. You need to extract just the 10-digit number from all of them. ...

🔰 Pattern 2: Sliding Window Table of Contents What is the Sliding Window Technique? When to Use Sliding Window? Types of Sliding Window Template Code Problem Set Problem 1: Maximum Sum Subarray of Size K Problem 2: Longest Substring Without Repeating Characters Problem 3: Maximum Average Subarray I Problem 4: Minimum Size Subarray Sum Problem 5: Permutation in String Problem 6: Longest Repeating Character Replacement Problem 7: Fruit Into Baskets Problem 8: Minimum Window Substring Problem 9: Sliding Window Maximum Problem 10: Substring with Concatenation of All Words Key Takeaways & Summary What is the Sliding Window Technique? In the Two Pointers pattern, we learned how two indices can traverse an array efficiently. Sliding Window builds on that idea - it maintains a range (window) between two pointers and cares about the elements inside that range. ...

Stacks Table of Contents What You Will Learn in This Blog What is a Stack Core Stack Operations Implementing a Stack Implementation 1 – Using a Python List Implementation 2 – Using a Linked List Which Implementation to Use The Call Stack How Python Uses a Stack for Function Calls Stack Overflow Monotonic Stack What is a Monotonic Stack Monotonic Increasing Stack Monotonic Decreasing Stack The Template Time and Space Complexity Patterns and Techniques Pattern 1 – Stack for Matching and Validation Pattern 2 – Stack for State Tracking Pattern 3 – Monotonic Stack Summary Key Takeaways Practice Problems Next Steps What You Will Learn in This Blog What a stack is and the LIFO principle The four core operations: push, pop, peek, and isEmpty Two ways to implement a stack from scratch – using a list and using a linked list How Python uses a stack internally for function calls and recursion What a monotonic stack is and when to reach for it Three problem-solving patterns that use stacks Solved LeetCode problems with full explanation A practice problem table for further study What is a Stack A stack is a linear data structure that follows the Last In, First Out principle – LIFO. The last element added is the first one to be removed. ...

Strings Table of Contents What You Will Learn in This Blog What is a String ASCII Unicode Strings in Python – Immutability String Operations and Time Complexity Common String Methods Strings as Arrays Patterns and Techniques Pattern 1 – Two Pointers on Strings Pattern 2 – Sliding Window on Strings Pattern 3 – Hashing for String Problems Summary Key Takeaways Practice Problems Next Steps What You Will Learn in This Blog What a string is at the byte level – characters, ASCII, and Unicode How Python represents strings in memory Why strings in Python are immutable and what that means in practice All common string operations and their time complexity How to build strings efficiently and avoid a common O(n^2) trap Three patterns applied to strings: Sliding Window, Two Pointers, and Hashing Solved LeetCode problems for each pattern with full explanation A practice problem table for further study What is a String At the most fundamental level, a string is a sequence of characters. But computers do not natively understand characters – they only understand numbers. So every character is mapped to a number, and that number is stored in memory. ...

The Complete DSA with Python – Master Roadmap What This Guide Is A hands-on, no-nonsense guide to learning Data Structures and Algorithms using Python. The goal is to build genuine understanding, not to memorise solutions. Every topic covers: The concept from first principles Python implementation with full code and complexity analysis The common patterns and techniques that come from that data structure Hands-on LeetCode problems tied directly to the topic What You Need Before Starting Basic Python: variables, loops, conditionals, functions, lists, dicts No prior DSA knowledge needed. Everything else is explained from scratch. The Roadmap Part 1 – Foundation Blog What You Will Learn What is DSA and why do we learn it What data structures and algorithms are, why they matter, how this guide is structured How to use this guide and how to practice Learning philosophy, how to approach problems, how to use LeetCode effectively Python refresher for DSA Lists, dicts, sets, tuples, list comprehensions, functions – the Python tools you will use constantly Part 2 – Complexity Analysis Before touching any data structure, you need this vocabulary. Every single blog after this uses it. ...

🔰 Pattern 1: Two Pointers Table of Contents What is the Two Pointer Technique? When to Use Two Pointers? Types of Two Pointer Patterns Visual Walkthrough Template Code Problem Set Problem 1: Two Sum II – Input Array Is Sorted Problem 2: Valid Palindrome Problem 3: Remove Duplicates from Sorted Array Problem 4: Container With Most Water Problem 5: 3Sum Problem 6: Trapping Rain Water Problem 7: Sort Colors (Dutch National Flag) Problem 8: Move Zeroes Problem 9: Squares of a Sorted Array Problem 10: Merge Sorted Array Key Takeaways & Summary What is the Two Pointer Technique? Two Pointers is a technique where you use two index variables that move through an array or string - either toward each other from opposite ends, or in the same direction at different speeds - to solve a problem efficiently. ...
Type Hints in Python Writing Code That Explains Itself – The typing Module and Beyond Before We Begin – Why Type Hints Matter Here is a function: def calculate_discount(price, discount, is_member): ... What type is price? A float? An int? A string like "1299"? What is discount? A percentage like 18.5? Or a multiplier like 0.185? What does is_member do to the result? You cannot tell without reading the implementation. In a codebase with hundreds of functions, this adds up to an enormous cognitive load. ...

What is DSA and Why Do We Learn It Table of Contents What You Will Learn in This Blog What is a Data Structure What is an Algorithm Why Do We Learn DSA How This Guide is Structured How to Practice – The Right Way The Problem-Solving Framework How to Use LeetCode Common Mistakes to Avoid What You Need Before Continuing Summary Key Takeaways Next Steps What You Will Learn in This Blog What data structures are and why they exist What algorithms are and how they relate to data structures Why learning DSA makes you a better problem solver How this guide is structured and how to navigate it How to practice effectively – LeetCode strategy, problem-solving framework, and common mistakes to avoid What is a Data Structure When you write a program, you are almost always working with data. You store it, retrieve it, update it, and delete it. A data structure is simply a way of organising that data so that your program can work with it efficiently. ...
Working with the Real World APIs, JSON, Dates, and HTTP Requests in Python Before We Begin – What Changes After This Guide Everything you have learned so far has worked entirely inside your own machine. You write code, it runs, it produces output, it reads files you already have. This guide is where that changes. After this guide your Python programs will be able to: Ask a server in another country for the current weather in Mumbai Get the latest currency exchange rate between INR and USD Pull real-time cricket scores from a sports API Send data to a web service and get a response back Work with dates and times the way real applications do This is not tutorial-level Python anymore. This is the Python that powers every data pipeline, every web application, every automation script, and every data science project that talks to the outside world. ...