Two Pointers Pattern

Array Patterns - The Complete Study Guide

🗺️ Array Patterns - The Complete Study Guide Welcome This is a structured, beginner-friendly study guide for mastering array and string patterns - the building blocks of coding interviews. Each pattern has a dedicated deep-dive document with theory, intuition, templates, and 10 LeetCode problems solved step by step. Who is this for? You’re preparing for coding interviews and want a systematic approach You can solve easy problems but struggle to recognize which technique to apply You want to understand why an approach works, not just memorize solutions How to use this guide: ...

March 21, 2026 · 6 min · 1229 words ·  · By codeverra
Arrays in DSA

Arrays in Python - Complete Guide

Arrays Table of Contents What You Will Learn in This Blog How Data is Stored in Computer Memory What is an Array Arrays in Python Python Lists The array Module NumPy Arrays Comparison of the Three Referential Arrays vs Value Arrays Dynamic Arrays – How Python Lists Grow Time and Space Complexity of Array Operations Two-Dimensional Arrays Patterns and Techniques Pattern 1 – Two Pointers Pattern 2 – Sliding Window Pattern 3 – Prefix Sum Summary Key Takeaways Practice Problems Next Steps What You Will Learn in This Blog How data is stored in computer memory and why it matters What an array is and how it uses contiguous memory How Python represents arrays – lists, the array module, and NumPy The difference between referential arrays and value arrays How dynamic arrays work and how Python lists resize themselves Time and space complexity of every common array operation Three core patterns that come from arrays: Two Pointers, Sliding Window, and Prefix Sum Solved LeetCode problems for each pattern A practice problem table for further study How Data is Stored in Computer Memory Before we talk about arrays, we need to understand the environment arrays live in – computer memory. ...

March 21, 2026 · 23 min · 4718 words ·  · By codeverra
Binary Search Pattern

Binary Search Pattern - Complete Guide

🔰 Pattern 2: Binary Search Table of Contents What is Binary Search? The Core Idea - Why Halving Works The Three Binary Search Templates Binary Search on Answer - The Hidden Pattern Common Pitfalls Problem Set Problem 1: Binary Search Problem 2: Search Insert Position Problem 3: Find First and Last Position of Element in Sorted Array Problem 4: Search a 2D Matrix Problem 5: Search in Rotated Sorted Array Problem 6: Find Minimum in Rotated Sorted Array Problem 7: Koko Eating Bananas Problem 8: Capacity to Ship Packages Within D Days Problem 9: Split Array Largest Sum Problem 10: Median of Two Sorted Arrays Key Takeaways & Summary What is Binary Search? In the Two Pointers pattern, we used two indices to narrow down a search space. Binary search takes that idea to its most powerful form: instead of narrowing one step at a time, we cut the search space in half at every step. ...

March 21, 2026 · 37 min · 7715 words ·  · By codeverra
Complexity Analysis

Complexity Analysis - Time and Space

Complexity Analysis – Time and Space Table of Contents What You Will Learn in This Blog Why Do We Need Complexity Analysis Building Intuition First How We Evaluate Algorithms – A Brief History Approach 1 – Experimental Analysis Approach 2 – Counting Every Operation Exactly Approach 3 – Asymptotic Analysis Primitive Operations – The Foundation of the Model What is Big O Notation The Common Complexity Classes O(1) – Constant Time O(log n) – Logarithmic Time O(n) – Linear Time O(n log n) – Linearithmic Time O(n^2) – Quadratic Time O(2^n) – Exponential Time O(n!) – Factorial Time Comparing the Complexity Classes How to Analyse Code Step by Step Space Complexity Common Misconceptions Complexity of Python Built-ins Practice Problems Summary Key Takeaways Next Steps What You Will Learn in This Blog Why complexity analysis exists and what problem it solves How to think about the efficiency of code intuitively before using any formula What Big O notation is and what it actually means The most common complexity classes with examples and code for each How to analyse any piece of code step by step Space complexity and how to think about memory usage Common misconceptions that trip up beginners Practice problems to test your understanding Why Do We Need Complexity Analysis Before anything else, let us answer the most important question: why does this topic exist at all? ...

March 21, 2026 · 24 min · 4942 words ·  · By codeverra
Hashmap Frequency Pattern

HashMap and Frequency Counting Pattern - Complete Guide

🔰 Pattern 4: HashMap / Frequency Counting Table of Contents What is the HashMap Pattern? When to Use HashMaps? Types of HashMap Patterns Template Code Problem Set Problem 1: Two Sum Problem 2: Valid Anagram Problem 3: Group Anagrams Problem 4: Top K Frequent Elements Problem 5: Longest Consecutive Sequence Problem 6: Contains Duplicate II Problem 7: Intersection of Two Arrays II Problem 8: First Unique Character in a String Problem 9: 4Sum II Problem 10: Encode and Decode TinyURL Key Takeaways & Summary What is the HashMap Pattern? In the previous patterns, we’ve already used hashmaps as a supporting tool - tracking character frequencies in sliding window, storing prefix sums for subarray problems. In this section, we focus on problems where the hashmap is the core of the solution, not just a helper. ...

March 21, 2026 · 36 min · 7599 words ·  · By codeverra
Linked Lists in DSA

Linked Lists in Python - Complete Guide

Linked Lists Table of Contents What You Will Learn in This Blog Why Linked Lists Exist What is a Node What is a Linked List Singly Linked List Building the Node Class Building the LinkedList Class Append – Insert at Tail Prepend – Insert at Head Insert at Position Delete by Value Delete at Position Search Traverse and Print Length of the List Reverse a Linked List Singly Linked List – Complete Implementation Time and Space Complexity Summary Doubly Linked List Building the DoublyNode Class Building the DoublyLinkedList Class Append and Prepend Insert at Position Delete by Value Traverse Forward and Backward Doubly Linked List – Complete Implementation Time and Space Complexity Summary Circular Linked List What Makes it Circular Building the CircularLinkedList Class Append and Prepend Delete by Value Traverse Circular Linked List – Complete Implementation Time and Space Complexity Summary Arrays vs Linked Lists – When to Use Which Python and Linked Lists Patterns and Techniques Pattern 1 – Fast and Slow Pointers Pattern 2 – In-place Reversal Summary Key Takeaways Practice Problems Next Steps What You Will Learn in This Blog Why linked lists exist and what problem they solve compared to arrays What a node and a pointer are How to build a Singly Linked List from scratch with all operations How to build a Doubly Linked List from scratch with all operations How to build a Circular Linked List from scratch with all operations Time and space complexity of every operation Two patterns: Fast and Slow Pointers, and In-place Reversal Solved LeetCode problems with full explanation A practice problem table for further study Why Linked Lists Exist In the Arrays blog, we learned that arrays store elements in contiguous memory – one right after the other. This gives us O(1) access by index, which is powerful. But contiguous memory comes with a cost: ...

March 21, 2026 · 31 min · 6482 words ·  · By codeverra
Prefix Sum Pattern

Prefix Sum Pattern - Complete Guide

🔰 Pattern 3: Prefix Sum Table of Contents What is Prefix Sum? Building the Intuition Step by Step The Range Sum Formula - Why It Works Common Variations Template Code Problem Set Problem 1: Range Sum Query – Immutable Problem 2: Running Sum of 1D Array Problem 3: Find Pivot Index Problem 4: Subarray Sum Equals K Problem 5: Contiguous Array Problem 6: Product of Array Except Self Problem 7: Subarray Sums Divisible by K Problem 8: Range Sum Query 2D – Immutable Problem 9: Continuous Subarray Sum Problem 10: Count Number of Nice Subarrays Key Takeaways & Summary What is Prefix Sum? Consider this scenario: you have an array of numbers and someone keeps asking you “what’s the sum of elements from index i to index j?” - not once, but hundreds of times with different i and j values. ...

March 21, 2026 · 41 min · 8588 words ·  · By codeverra
Python Refresher for DSA

Python Refresher for DSA

Python Refresher for DSA Table of Contents What You Will Learn in This Blog Python Built-in Data Types for DSA Lists Dictionaries Sets Tuples The Collections Module deque defaultdict Counter List Comprehensions Important Built-in Functions for DSA Sorting in Python String Operations heapq – The Built-in Min Heap Common Python Patterns in DSA Summary Key Takeaways Next Steps What You Will Learn in This Blog The Python built-in data types you will use constantly in DSA How lists, dictionaries, sets, and tuples work and when to use each Important Python built-in functions and their complexities The collections module – deque, defaultdict, Counter List comprehensions and when to use them Common Python patterns that appear repeatedly in DSA problems This is not a complete Python tutorial. It covers exactly what you need to follow the rest of this guide comfortably. If you are already confident with all of the above, you can skim this and move on. ...

March 21, 2026 · 16 min · 3233 words ·  · By codeverra
Sliding Window Pattern

Sliding Window Pattern - Complete Guide

🔰 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. ...

March 21, 2026 · 42 min · 8899 words ·  · By codeverra