Posts tagged

Arrays

The Sliding Window Technique: Explained with 5 Interview Problems

A complete guide to the sliding window technique for coding interviews. Explains why windows beat recomputing every subarray from scratch, the crucial difference between fixed-size and variable-size windows, and the grow/shrink template that solves nearly every variable-window problem. Works through five interview problems with full Python solutions: Maximum Sum Subarray of Size K, Longest Substring Without Repeating Characters, Minimum Size Subarray Sum, Longest Repeating Character Replacement, and Minimum Window Substring. Covers the amortized O(n) argument, window-state bookkeeping with hash maps, and the signals that tell you a problem wants a sliding window.

Two Pointer Technique: When to Use It and 6 Problems Solved

A pattern-recognition guide to the two pointer technique for coding interviews. Explains the three flavors (converging pointers on sorted data, fast/slow same-direction pointers, and pointers across two sequences) and the problem-statement signals that tell you which one to reach for. Works through six interview problems from easy to hard with Python solutions: Two Sum II, Valid Palindrome, Remove Duplicates from Sorted Array, Container With Most Water, 3Sum, and Trapping Rain Water. Covers why the converging-pointer proof works, the deduplication details that break 3Sum, and a checklist for spotting two pointer problems in the wild.

Lists and Arrays: Storing Collections of Data

Introduces Python lists as ordered, mutable collections and walks through creation, zero-based indexing, negative indexing, and common methods like append, insert, remove, and pop. Also covers list comprehensions for concisely generating filtered or transformed lists, nested lists for representing matrices, and the array module as a memory-efficient alternative for homogeneous numeric data. Concludes with a practical to-do list manager exercise that reinforces add and remove operations interactively.

Arrays and Lists: Mastering Collections in Python

A thorough introduction to Python lists covering creation with mixed types, element access and slicing, and the full set of list methods including sort, reverse, count, and index. Explains list comprehensions for filtering and transforming data, nested lists for 2D data structures, and the array module for typed, memory-efficient numeric storage. The practical section builds a to-do list manager, and a Tic-Tac-Toe challenge invites readers to apply nested lists to model a game board with win detection.

Question: Matrix Multiplication Why We Need Nested Loops

Written in response to a community member's question about why matrix multiplication requires three nested loops rather than a simpler approach. Explains what a matrix is as a 2D array-of-arrays, walks through the dot-product calculation that each result cell requires, and maps each loop level to a specific role: the outer loop selects rows of the first matrix, the middle loop selects columns of the second, and the inner loop accumulates the element-wise products. Includes a clean Python implementation and a worked 2x2 numeric example.