Arrays & Strings Course
Master production-grade problem solving, algorithm thinking, array manipulation, string processing & coding interview patterns.
Architecture
Array Traversal & Algorithm Lifecycle
From input array to optimized output — through traversal, condition checks, processing and result accumulation.
Enterprise learning path
Arrays Fundamentals
- 1Arrays HomeNext up
An array is a collection of items stored in contiguous memory locations.
- 2Introduction to Arrays
An array stores multiple values under a single variable name, accessed by an index.
- 3How Arrays Work
Arrays use contiguous memory blocks.
- 4Static vs Dynamic Arrays
Static arrays have a fixed length (C arrays, Java arrays).
- 5Array Memory Representation
Every array element sits next to the previous one in RAM.
- 6Array Traversal
Traversal means visiting every element exactly once.
- 7Insertion in Arrays
Inserting at the end is O(1) amortized.
- 8Deletion in Arrays
Deleting an element requires shifting later elements left to fill the gap.
- 9Updating Array Elements
Updating is O(1): you compute the address from the index and overwrite the value.
- 10Array Time Complexity
Access O(1), search O(n), insert at end O(1) amortized, insert/delete in middle O(n).
- 11Multi-Dimensional Arrays
2D arrays are arrays of arrays — a grid of rows and columns.
- 12Common Array Operations
Sum, average, min, max, reverse, copy, fill, contains.
- 13Array Patterns
Patterns: prefix sum, sliding window, two pointers, fast/slow, sort+scan, hashmap counting.
- 14Prefix Sum Basics
Prefix sum lets you answer 'sum of any subarray' in O(1) after O(n) preprocessing.
- 15Kadane's Algorithm
Kadane finds the maximum sum contiguous subarray in O(n).
String Fundamentals
- 16Introduction to Strings
A string is a sequence of characters.
- 17String Memory Representation
Strings are stored as contiguous arrays of bytes (ASCII) or code units (UTF-16, UTF-8).
- 18String Traversal
Loop from i=0 to length-1, read s[i].
- 19Character Arrays
A char[] is a mutable array of characters.
- 20Immutable vs Mutable Strings
String objects in Java/Python/JS are immutable — every concatenation creates a new object.
- 21String Manipulation
Splitting, joining, replacing, trimming, slicing — basic transformations every developer uses daily.
- 22String Comparison
== compares references, equals/strcmp/.compareTo compares characters.
- 23String Builder Concepts
StringBuilder uses a resizable char buffer to append in O(1) amortized.
- 24Palindrome Problems
A palindrome reads the same forwards and backwards.
- 25Frequency Counting
Count character occurrences with a 26-int array (lowercase) or HashMap.
- 26Anagram Problems
Two strings are anagrams if they contain the same characters in any order.
- 27Pattern Matching Basics
Finding a pattern P inside text T.
- 28ASCII & Unicode
ASCII has 128 chars (0-127).
- 29String Complexity Analysis
Length n: traversal O(n), substring O(k), concat O(n+m), sort O(n log n), naive search O(n·m).
- 30Real-World String Problems
Validating email, parsing URLs, sanitizing user input, building a search engine, log-line parsing — strings are everywhere.
Array Algorithms
- 31Linear Search
Walk through every element until found.
- 32Binary Search
Search a sorted array in O(log n) by repeatedly halving the range.
- 33Bubble Sort
Repeatedly swap adjacent out-of-order pairs.
- 34Selection Sort
Find the smallest element and put it at index 0, then the next smallest at index 1, and so on.
- 35Insertion Sort
Build the sorted prefix one element at a time.
- 36Merge Sort Basics
Divide array in half, sort each half recursively, merge in O(n).
- 37Quick Sort Basics
Pick a pivot, partition smaller/larger elements, recurse.
- 38Two Sum Problem
Find two indices i,j such that nums[i]+nums[j]=target.
- 39Maximum Subarray
Find the contiguous subarray with the largest sum.
- 40Rotate Array
Shift array right by k.
- 41Move Zeroes
Move all zeros to the end without changing relative order.
- 42Product Array Puzzle
Build array where output[i] = product of all nums except nums[i] — without division and in O(n).
- 43Prefix Sum Problems
Range-sum, equilibrium index, subarray sum equals K.
- 44Difference Array
To apply many range increments efficiently, store +x at l and -x at r+1; one prefix sum at the end gives final array.
- 45Advanced Array Patterns
Monotonic deque, sparse table, Mo's algorithm, square-root decomposition — patterns above the basics that solve the hardest problems.
String Algorithms
- 46Reverse String
Use two pointers from both ends and swap.
- 47Reverse Words
Reverse the entire string, then reverse each word.
- 48Longest Common Prefix
Compare characters of all strings index-by-index until mismatch.
- 49Longest Substring Without Repeating
Sliding window + hashmap.
- 50String Compression
Run-length encode 'aaabb' as 'a3b2'.
- 51Rabin-Karp Basics
Compare rolling hashes to find pattern in O(n+m) average.
- 52KMP Algorithm Introduction
Build failure function so the pattern never re-checks prefixes.
- 53Z Algorithm Basics
Compute Z[i] = longest substring starting at i that matches a prefix.
- 54Sliding Window on Strings
Maintain a moving window with character counts.
- 55String Hashing Basics
Polynomial rolling hash for fast substring comparison.
- 56Regex Basics
Patterns to describe strings: anchors, character classes, quantifiers, groups, lookaheads.
- 57Text Processing Problems
Word count, log parsing, CSV splitting, tokenizing — daily backend chores.
- 58Encoding & Decoding
Run-length, base64, URL encode, JSON escape — convert strings between formats safely.
- 59String Optimization Problems
Minimum operations to make equal, longest palindromic substring, edit distance — DP-heavy challenges.
- 60Advanced String Challenges
Suffix arrays, suffix trees, Aho-Corasick — state-of-the-art techniques for search and bioinformatics.
Searching & Sorting
- 61Searching Algorithms
Linear, binary, ternary, exponential, interpolation — pick the one that fits your data and constraints.
- 62Binary Search Patterns
Lower bound, upper bound, search-on-answer, rotated arrays.
- 63Lower Bound & Upper Bound
Lower bound: first index ≥ x.
- 64Sorting Fundamentals
Comparison-based sorts can't beat O(n log n).
- 65Stable vs Unstable Sorting
A stable sort preserves the relative order of equal keys.
- 66Merge Sort Deep Dive
External sorting, parallel merge sort, in-place variants.
- 67Quick Sort Deep Dive
Random pivot, three-way partition (Dutch flag), introsort.
- 68Heap Sort Basics
Build a max heap in O(n), extract max n times.
- 69Counting Sort
O(n + k) when keys are integers in range [0, k].
- 70Bucket Sort
Distribute into k buckets, sort each, concatenate.
- 71Searching in Rotated Arrays
Modified binary search; pick the sorted half each step.
- 72Peak Element Problems
Binary search on slope direction.
- 73Search Optimization
Index, sort once and binary search many times, cache hot keys, use bloom filters for membership.
- 74Sorting Complexity Analysis
Time, space, stability, in-place — choose by constraints, not by name.
- 75Real Interview Problems
Sort + two pointers, sort + binary search, sort + greedy — hybrid recipes from FAANG sets.
Sliding Window & Two Pointers
- 76Sliding Window Introduction
Maintain a window over the array and slide it instead of recomputing every range.
- 77Fixed Size Window
Window of size k slides one step at a time; add the new element, drop the old.
- 78Dynamic Window
Window grows when valid, shrinks when invalid.
- 79Two Pointer Basics
Two indices traverse the array.
- 80Opposite Direction Pointers
One starts at the beginning, one at the end; they move toward each other.
- 81Fast & Slow Pointer
Fast moves twice as fast as slow.
- 82Longest Subarray Problems
Longest with sum=k, longest with at most k distinct, longest no-repeat — all sliding window patterns.
- 83Minimum Window Problems
Find shortest substring containing all chars of T.
- 84Subarray Sum Problems
Subarray sum equals k via prefix sum + hashmap; subarray with sum divisible by k via mod hashmap.
- 85Duplicate Detection
HashSet, sort+scan, frequency array, Floyd's cycle on indices — many ways to find duplicates.
- 86Partition Problems
Dutch flag, segregate odd/even, sort colors — partition with two or three pointers in O(n).
- 87Window Optimization
Use deque to maintain max/min in O(1) per element.
- 88Pattern Recognition
Nested loop with j depending on i?
- 89Real Coding Interview Patterns
Top 50 LeetCode patterns walkthrough — every one comes back as a slight variation.
- 90Advanced Window Challenges
Sliding window median, k-distinct subarray, count of nice subarrays — when basic windows aren't enough.
Advanced Problem Solving
- 91Greedy Array Problems
Make the locally optimal choice at every step.
- 92Matrix Problems
2D grid traversals, row/column ops, transpose, in-place rotation.
- 93Spiral Traversal
Visit a 2D matrix in spiral order with four pointers — top, bottom, left, right.
- 94Monotonic Stack Basics
Stack that only keeps increasing (or decreasing) elements.
- 95Prefix & Suffix Techniques
Combine prefix and suffix arrays to answer range queries without nested loops.
- 96HashMap Optimization
Convert nested loop searches into O(1) lookups.
- 97Frequency Arrays
Fixed-size int[26] or int[256] beats HashMap for ASCII problems by 5-10×.
- 98Sparse Arrays
Most cells are zero — store only non-zero entries with HashMap or coordinate list.
- 99Compression Algorithms
Run-length, Huffman, LZ77 — turn long arrays into short ones with no info loss.
- 100Data Stream Problems
Process elements one at a time without storing all of them.
- 101Competitive Programming Tricks
Bit manipulation, modular arithmetic, lookup tables, precomputation — gain milliseconds.
- 102Memory Optimization
Reuse buffers, in-place ops, primitive arrays vs object arrays, Java -Xmx tuning.
- 103Time Complexity Optimization
Replace O(n²) with O(n log n) via sort+pointer, or with O(n) via hashmap.
- 104Real Production Algorithm Cases
Pagination, search ranking, recommendation, deduplication — algorithms running 24/7 in real systems.
- 105Enterprise Problem Solving
Throughput, latency, SLA, observability — algorithms that survive production load.
Practice & Interview Preparation
- 106Arrays Exercises
20 hand-picked problems covering every fundamental array pattern, ordered easy → hard.
- 107Strings Exercises
20 string problems from reverse to KMP — graded difficulty.
- 108Sorting Challenges
Custom comparators, sort-then-scan, k-th element, top-k frequent.
- 109Sliding Window Challenges
Top-15 LeetCode sliding window questions with full solutions.
- 110Binary Search Challenges
Search-on-answer problems: ship-capacity, koko-bananas, split-array.
- 111Coding Interview Questions
100+ FAANG-style questions with hints, brute force, optimal, and follow-ups.
- 112Mock DSA Interviews
Three full 45-minute mock interview scripts with rubric and feedback.
- 113LeetCode Style Problems
Curated path: 75 essential problems → 150 → 300.
- 114Real Interview Scenarios
'Walk me through how you'd…' open-ended scenarios that test communication.
- 115FAANG Problem Solving
Google, Meta, Amazon, Apple, Microsoft — the patterns each company favours.
- 116Optimization Challenges
Take a working O(n²) and reach O(n log n) or O(n).
- 117Debugging Tasks
Spot the off-by-one, the wrong base case, the integer overflow — train your eye.
- 118Whiteboard Coding Practice
No autocomplete, no compiler — neat handwriting + think-aloud habits.
- 119Pattern Recognition Challenges
Given a problem, name the pattern in under 30 seconds.
- 120Enterprise Coding Assessments
HackerRank, Codility, CoderPad style timed tests with sample rubrics.