▶System Design Patterns
9 patterns
Animated sequence diagrams — see every hop, failure mode, and fix with real code.
Fan-Out / Event Pipeline
Decouple producers from consumers via an async event bus
Cache-Aside (Read-Through)
Serve reads from cache; populate on miss; invalidate on write
News Feed / Timeline
Pre-compute feeds on write so reads are O(1); pull for celebrities to avoid thundering herd
Rate Limiting / Infra
Atomic Redis INCR per user window — never count in app memory
Distributed Storage
Presigned URLs keep large files off your API server; metadata DB tracks everything else
Proximity / Geo Search
Geohash converts 2D spatial queries into O(log M) prefix lookups — Redis GEORADIUS runs in sub-10ms
Real-Time / Streaming
Pub-sub routes messages across the server fleet in one publish call
Search & Ranking
Inverted index for O(1) term lookup; two-phase retrieve-then-rank for relevance
Write-Heavy / Append-Only
Kafka log + columnar store — decouple ingest from analytics
▶Algorithm Patterns
22 modules · 47 patterns · 497 problems · 87 core
▶Foundations2 patterns · 12 problems · 3 core
- ●Values, Variables, and Types
- ●Memory Size of Types
- ●References vs Values
- ●Constant vs Linear Time
- ●Quadratic Time
▶Linear Scaniterative6 problems · 2 core
Single pass through input making a per-element decision; no auxiliary data structure
▶Sort + Linear Scaniterative1 problem · 1 core
Sort first, then iterate to find pairs/sequences/answer
▶Arrays4 patterns · 16 problems · 5 core
- ●What is an Array?
- ●Reading and Updating Elements
- ●Iterating Through Arrays
- ●Searching in Arrays
- ●Adding and Removing at End
- ●Adding and Removing at Middle
- ●Count Occurrences
- ●Rotate Array
- ●Dynamic Arrays
- ●Items in Containers
- ●Load Balancer
▶Greedy — Running Max/Min Trackingiterative2 problems · 2 core
Single pass; maintain running min/max and update answer greedily
▶Two Pointers — Same Direction (Slow/Fast)iterative1 problem · 1 core
Slow read pointer + fast write pointer (or different speeds), both moving forward
▶Two Pointers — Mergeiterative1 problem · 1 core
Two pointers across two sorted inputs, advancing whichever is smaller
▶Data Structure Designdesign1 problem · 1 core
Build a class supporting a defined set of operations efficiently
▶Strings9 patterns · 19 problems · 13 core
▶Hash Set — Membership Checkiterative2 problems · 2 core
Build a Set of seen items; check membership in O(1)
▶Two Pointers — Opposite Endsiterative3 problems · 2 core
Two pointers starting at both ends, converging toward the middle
- ●String Methods
- ●Is Palindrome
- Extra practice
- ●Reverse String
▶Hash Map — Frequency Counteriterative2 problems · 2 core
Build a Map of element → count; query the map
▶Two Pointers — Same Direction (Slow/Fast)iterative2 problems · 2 core
Slow read pointer + fast write pointer (or different speeds), both moving forward
▶DP — Bitmask (Subset State)dp1 problem · 1 core
DP where state is a bitmask representing which items have been used/visited
▶DP — Sequence (LCS-style)dp1 problem · 1 core
dp[i][j] over two strings/arrays; compares chars at i, j
▶Greedy — Running Max/Min Trackingiterative1 problem · 1 core
Single pass; maintain running min/max and update answer greedily
▶Binary Search — Boundary (First True)iterative1 problem · 1 core
Find the first index where a predicate becomes true (or last where it's false)
▶Linear Scaniterative1 problem · 1 core
Single pass through input making a per-element decision; no auxiliary data structure
▶Linked List4 patterns · 20 problems · 7 core
- ●What is a Linked List?
- ●Nodes and Pointers
- ●Traversing a Linked List
- ●Insert at Head and Tail
- ●Linked List vs Array
- ●Delete Node Without Head Access
- ●Doubly Linked Lists
- ●Queue with Linked List
- ●Linked list Introduction
▶Linked List — Dummy + Predecessoriterative2 problems · 2 core
Use dummy head + curr-as-predecessor pattern; check curr.next, mutate or advance
▶Linked List — Two Pointers (Slow/Fast)iterative6 problems · 2 core
Slow advances 1 step, fast advances 2 — Floyd's cycle detection style
▶Two Pointers — Opposite Endsiterative1 problem · 1 core
Two pointers starting at both ends, converging toward the middle
▶Linked List — Reverse In-Placeiterative2 problems · 2 core
Iterate with prev/curr/next; flip pointer each step
▶Queue4 patterns · 11 problems · 7 core
▶Event Simulationiterative4 problems · 2 core
Step through events/time/state transitions in order, updating world state per step
▶Data Structure Designdesign2 problems · 2 core
Build a class supporting a defined set of operations efficiently
▶Linear Scaniterative2 problems · 2 core
Single pass through input making a per-element decision; no auxiliary data structure
▶Sliding Window — Fixed Size kiterative1 problem · 1 core
Window of fixed size k slides across the array; maintain rolling stat
▶Hash Tables5 patterns · 31 problems · 8 core
- ●What is Hashing?
- ●Hash Functions
- ●Collision Handling
- ●Hashing to Bucket Index
- ●Sparse Matrix Multiplication
- ●All O1 Data Structurehard
- ●First Missing Positivehard
- ●Insert Delete Getrandom O1medium
- ●Product Of Array Except Selfmedium
▶Hash Set — Membership Checkiterative4 problems · 2 core
Build a Set of seen items; check membership in O(1)
▶Hash Map — Frequency Counteriterative14 problems · 2 core
Build a Map of element → count; query the map
- ●Using Built-in Hash Tables
- ●Count Frequencies
- Extra practice
- ●Valid Anagram
- ●First Unique Character
- ●Intersection of Arrays
- ●Debt Records | Smallest Negative Balance
- ●Split Strings
- ●Group Anagrams
- ●Isomorphic String
- ●Most Common Word with Exclusion List
- ●Transaction Logs
- ●K-different Pairs in an Array
- ●Partition Array
- ●Ransom Noteeasy
▶Hash Map — Complement Lookupiterative2 problems · 2 core
For each item, look up its complement (target - item) in the map
▶Sort + Linear Scaniterative1 problem · 1 core
Sort first, then iterate to find pairs/sequences/answer
▶Trie — Prefix Tree Searchrecursive1 problem · 1 core
Build a trie of words; query with prefix or backtracking traversal
▶Stack7 patterns · 26 problems · 9 core
- ●Stack - The LIFO Model
- ●Stack Operations
- ●Implementing Stack with Array
- ●Stack vs Queue - LIFO vs FIFO
- ●Implement Queue Using Stackseasy
- ●Min Stackmedium
▶Stack — Matching/Validationiterative8 problems · 2 core
Push openers; pop and check match on closers
▶Stack — Monotoniciterative7 problems · 2 core
Maintain stack in monotonic order; pop while invariant violated
▶Backtracking — Generate Allrecursive1 problem · 1 core
Recursively build candidates; choose, recurse, undo (push/pop)
▶Greedy — Running Max/Min Trackingiterative1 problem · 1 core
Single pass; maintain running min/max and update answer greedily
▶Sort + Linear Scaniterative1 problem · 1 core
Sort first, then iterate to find pairs/sequences/answer
▶Binary Search — On Answer Spaceiterative1 problem · 1 core
Binary search over the answer values themselves; check feasibility at mid
▶Sweep Lineiterative1 problem · 1 core
Sort events by position; sweep across maintaining an active set
▶Sorting3 patterns · 22 problems · 6 core
▶Sort — Implementations (Pedagogical)iterative7 problems · 2 core
Implement a sorting algorithm from scratch (bubble, insertion, selection, merge, quick)
▶Sort — Custom Comparatoriterative9 problems · 2 core
Use built-in sort with a custom comparison function
▶Sort + Linear Scaniterative5 problems · 2 core
Sort first, then iterate to find pairs/sequences/answer
▶Algorithm Intros15 patterns · 22 problems · 17 core
▶Divide and Conquerrecursive1 problem · 1 core
Split into smaller subproblems, solve recursively, combine results
▶Hash Map — Complement Lookupiterative1 problem · 1 core
For each item, look up its complement (target - item) in the map
▶Intervals — Sort + Mergeiterative1 problem · 1 core
Sort intervals by start; iterate and merge overlapping
▶DP — 0/1 Knapsackdp1 problem · 1 core
Choose subset of items to maximize value within capacity
▶Sweep Lineiterative1 problem · 1 core
Sort events by position; sweep across maintaining an active set
▶DP — 1Ddp1 problem · 1 core
dp[i] depends on a small fixed number of previous values
▶Stack — Monotoniciterative1 problem · 1 core
Maintain stack in monotonic order; pop while invariant violated
▶Binary Search — Standarditerative1 problem · 1 core
Find an exact value (or report not found) in a sorted array
▶Union Find (DSU)iterative1 problem · 1 core
Disjoint set union with path compression and union by rank
▶Data Structure Designdesign3 problems · 2 core
Build a class supporting a defined set of operations efficiently
- ●Queue Intro
- ●Segment Tree Introduction
- Extra practice
- ●Trie Introduction
▶Event Simulationiterative1 problem · 1 core
Step through events/time/state transitions in order, updating world state per step
▶Sort — Implementations (Pedagogical)iterative1 problem · 1 core
Implement a sorting algorithm from scratch (bubble, insertion, selection, merge, quick)
▶Stack — Matching/Validationiterative1 problem · 1 core
Push openers; pop and check match on closers
▶Topological Sort (Kahn's BFS)iterative1 problem · 1 core
Process nodes in dependency order using indegree + queue
▶Two Pointers — Opposite Endsiterative2 problems · 2 core
Two pointers starting at both ends, converging toward the middle
▶Two Pointers5 patterns · 14 problems · 7 core
▶Linked List — Two Pointers (Slow/Fast)iterative1 problem · 1 core
Slow advances 1 step, fast advances 2 — Floyd's cycle detection style
▶Two Pointers — Mergeiterative1 problem · 1 core
Two pointers across two sorted inputs, advancing whichever is smaller
▶Two Pointers — Same Direction (Slow/Fast)iterative3 problems · 2 core
Slow read pointer + fast write pointer (or different speeds), both moving forward
- ●Move Zeros
- ●Remove Duplicates
- Extra practice
- ●Sort Colorsmedium
▶Two Pointers — Opposite Endsiterative7 problems · 2 core
Two pointers starting at both ends, converging toward the middle
▶Hash Map — Complement Lookupiterative1 problem · 1 core
For each item, look up its complement (target - item) in the map
▶Sliding Window9 patterns · 26 problems · 12 core
▶Sliding Window — Variable Sizeiterative10 problems · 2 core
Window expands by moving right, shrinks by moving left when invariant violated
- ●Count Maximum Teams
- ●Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
- Extra practice
- ●Count Number of Nice Subarrays
- ●Least Consecutive Cards to Match
- ●Longest Substring without Repeating Characters
- ●Minimum Window Substring
- ●Subarray Sum Longest
- ●Subarray Sum Shortest
- ●Longest Repeating Character Replacementmedium
- ●Minimum Size Subarray Summedium
▶Sliding Window — Fixed Size kiterative7 problems · 2 core
Window of fixed size k slides across the array; maintain rolling stat
▶Hash Map — Frequency Counteriterative2 problems · 2 core
Build a Map of element → count; query the map
▶Hash Set — Membership Checkiterative1 problem · 1 core
Build a Set of seen items; check membership in O(1)
▶Two Pointers — Same Direction (Slow/Fast)iterative1 problem · 1 core
Slow read pointer + fast write pointer (or different speeds), both moving forward
▶Backtracking — Generate Allrecursive1 problem · 1 core
Recursively build candidates; choose, recurse, undo (push/pop)
▶Trie — Prefix Tree Searchrecursive1 problem · 1 core
Build a trie of words; query with prefix or backtracking traversal
▶Hash Map — Complement Lookupiterative1 problem · 1 core
For each item, look up its complement (target - item) in the map
▶Sort + Linear Scaniterative1 problem · 1 core
Sort first, then iterate to find pairs/sequences/answer
▶Binary Search5 patterns · 16 problems · 8 core
▶Hash Map — Frequency Counteriterative1 problem · 1 core
Build a Map of element → count; query the map
▶Sort + Linear Scaniterative1 problem · 1 core
Sort first, then iterate to find pairs/sequences/answer
▶Binary Search — Boundary (First True)iterative5 problems · 2 core
Find the first index where a predicate becomes true (or last where it's false)
▶Binary Search — Standarditerative4 problems · 2 core
Find an exact value (or report not found) in a sorted array
▶Binary Search — On Answer Spaceiterative5 problems · 2 core
Binary search over the answer values themselves; check feasibility at mid
▶Heap7 patterns · 18 problems · 10 core
▶Greedy + Heapiterative6 problems · 2 core
Use heap to always pick the optimal element greedily
▶Hash Map — Frequency Counteriterative2 problems · 2 core
Build a Map of element → count; query the map
▶Heap — Top Kiterative5 problems · 2 core
Maintain a heap of size k while scanning items
▶Sliding Window — Fixed Size kiterative1 problem · 1 core
Window of fixed size k slides across the array; maintain rolling stat
▶Sort + Linear Scaniterative1 problem · 1 core
Sort first, then iterate to find pairs/sequences/answer
▶Sort — Custom Comparatoriterative1 problem · 1 core
Use built-in sort with a custom comparison function
▶DP — 0/1 Knapsackdp1 problem · 1 core
Choose subset of items to maximize value within capacity
▶Intervals3 patterns · 8 problems · 4 core
▶Intervals — Sort + Mergeiterative6 problems · 2 core
Sort intervals by start; iterate and merge overlapping
▶Greedy — Sort + Linear Scaniterative1 problem · 1 core
Sort first; iterate making the locally optimal choice each step
▶Linear Scaniterative1 problem · 1 core
Single pass through input making a per-element decision; no auxiliary data structure
▶Backtracking5 patterns · 20 problems · 6 core
▶Backtracking — Generate Allrecursive16 problems · 2 core
Recursively build candidates; choose, recurse, undo (push/pop)
- ●Find All Combination of Numbers that Sum to a Target | Shopping Options
- ●Backtracking Template
- Extra practice
- ●Backtracking - Counting Problems
- ●Backtracking with Pruning
- ●Combination Sum
- ●Combine Numbers
- ●Concatenated String Length with unique Characters
- ●Generate All Letter Combinations from a Phone Number
- ●Partitioning A String Into Palindromes
- ●General All Permutations
- ●Split String Into Unique Primes
- ●Subsets
- ●Subsets
- ●Combinationsmedium
- ●Subsets IImedium
- ●Sudoku Solverhard
▶DP — Sequence (LCS-style)dp1 problem · 1 core
dp[i][j] over two strings/arrays; compares chars at i, j
▶Greedy — Running Max/Min Trackingiterative1 problem · 1 core
Single pass; maintain running min/max and update answer greedily
▶DP — 1Ddp1 problem · 1 core
dp[i] depends on a small fixed number of previous values
▶Trie — Prefix Tree Searchrecursive1 problem · 1 core
Build a trie of words; query with prefix or backtracking traversal
▶Math/Bit7 patterns · 15 problems · 9 core
- ●Day of week that is K days later
- ●Find Modulo of Exponent
- ●Fill 2D Array
- ●N-th prime
- ●Range max
- ●Unique Integers That Sum Up To 0
▶DP — 1Ddp1 problem · 1 core
dp[i] depends on a small fixed number of previous values
▶Backtracking — Generate Allrecursive1 problem · 1 core
Recursively build candidates; choose, recurse, undo (push/pop)
▶Event Simulationiterative1 problem · 1 core
Step through events/time/state transitions in order, updating world state per step
▶Linear Scaniterative2 problems · 2 core
Single pass through input making a per-element decision; no auxiliary data structure
▶Sort + Linear Scaniterative2 problems · 2 core
Sort first, then iterate to find pairs/sequences/answer
▶Binary Search — On Answer Spaceiterative1 problem · 1 core
Binary search over the answer values themselves; check feasibility at mid
▶Two Pointers — Opposite Endsiterative1 problem · 1 core
Two pointers starting at both ends, converging toward the middle
▶Greedy9 patterns · 20 problems · 12 core
▶Greedy — Sort + Linear Scaniterative5 problems · 2 core
Sort first; iterate making the locally optimal choice each step
▶Greedy — Running Max/Min Trackingiterative7 problems · 2 core
Single pass; maintain running min/max and update answer greedily
▶Sliding Window — Fixed Size kiterative1 problem · 1 core
Window of fixed size k slides across the array; maintain rolling stat
▶Linear Scaniterative2 problems · 2 core
Single pass through input making a per-element decision; no auxiliary data structure
▶Tree — DFS (Recursive)recursive1 problem · 1 core
Recursive function processes a node, then recurses on left and right
▶Two Pointers — Opposite Endsiterative1 problem · 1 core
Two pointers starting at both ends, converging toward the middle
▶Greedy + Heapiterative1 problem · 1 core
Use heap to always pick the optimal element greedily
▶Hash Map — Frequency Counteriterative1 problem · 1 core
Build a Map of element → count; query the map
▶DP — State Machine (Decision)dp1 problem · 1 core
Track multiple dp states (e.g., holding/not-holding stock); transition between states each step
▶Trees4 patterns · 29 problems · 6 core
▶Tree — DFS (Recursive)recursive21 problems · 2 core
Recursive function processes a node, then recurses on left and right
- ●Balanced Binary Tree
- ●Closest BST Values II
- Extra practice
- ●Flatten Binary Tree to Linked List
- ●Insert Into BST
- ●Invert Binary Tree
- ●K-th Smallest Number In BST
- ●Lowest Common Ancestor of a Binary Tree
- ●Lowest Common Ancestor of a Binary Search Tree
- ●Serializing and Deserializing Binary Tree
- ●Subtree with Maximum Average
- ●Tree DP Introduction
- ●Max depth of a binary tree
- ●Valid Binary Search Tree
- ●Visible Tree Node | Number of Visible Nodes
- ●Diameter Of Binary Treeeasy
- ●Maximum Depth Of Binary Treeeasy
- ●Same Treeeasy
- ●Subtree Of Another Treeeasy
- ●Sum Of Left Leaveseasy
- ●Validate Binary Search Treemedium
- ●House Robber IIImedium
▶Tree — BFS (Level Order)iterative5 problems · 2 core
Process tree level by level using a queue
▶Data Structure Designdesign1 problem · 1 core
Build a class supporting a defined set of operations efficiently
▶Greedy + Heapiterative1 problem · 1 core
Use heap to always pick the optimal element greedily
▶Graph17 patterns · 67 problems · 28 core
▶Topological Sort (Kahn's BFS)iterative6 problems · 2 core
Process nodes in dependency order using indegree + queue
▶Stack — Matching/Validationiterative1 problem · 1 core
Push openers; pop and check match on closers
▶Sort + Linear Scaniterative1 problem · 1 core
Sort first, then iterate to find pairs/sequences/answer
▶Two Pointers — Opposite Endsiterative1 problem · 1 core
Two pointers starting at both ends, converging toward the middle
▶Tree — BFS (Level Order)iterative1 problem · 1 core
Process tree level by level using a queue
▶Tarjan — Bridges / Articulation Pointsrecursive2 problems · 2 core
DFS with discovery/low-link tracking to find critical edges/vertices
▶Tree — DFS (Recursive)recursive4 problems · 2 core
Recursive function processes a node, then recurses on left and right
▶Dijkstra — Weighted Shortest Pathiterative3 problems · 2 core
Min-heap based shortest path on weighted graphs (non-negative weights)
▶Union Find (DSU)iterative10 problems · 2 core
Disjoint set union with path compression and union by rank
- ●Merge User Accounts
- ●Union Find | Disjoint Set Union Data Structure Introduction
- Extra practice
- ●Union Find | Disjoint Set Union Introductory Problem
- ●Union Find | Disjoint Set Union | Set Size
- ●Min Cost To Add New Roads
- ●Minimum Cost to Connect All Nodes (Minimum Spanning Tree I)
- ●Min Cost to Repair Edges (Minimum Spanning Tree II)
- ●Minimum Spanning Tree | Forests
- ●Number of Connected Components
- ●Graph Valid Treemedium
▶Graph — BFS/DFS on Adjacency Listiterative10 problems · 2 core
BFS or DFS over a graph represented as an adjacency list (or implicit state graph)
▶Graph — Grid DFSrecursive8 problems · 2 core
DFS on a 2D grid, marking visited cells in place or with set
▶Hash Map — Frequency Counteriterative1 problem · 1 core
Build a Map of element → count; query the map
▶DP — 2D Griddp2 problems · 2 core
dp[i][j] depends on dp[i-1][j], dp[i][j-1] (or similar neighbors)
▶DP — Bitmask (Subset State)dp1 problem · 1 core
DP where state is a bitmask representing which items have been used/visited
▶Graph — Grid BFS (Shortest Path)iterative8 problems · 2 core
BFS on a 2D grid using a queue, tracking distance
▶Binary Search — On Answer Spaceiterative2 problems · 2 core
Binary search over the answer values themselves; check feasibility at mid
▶Trie — Prefix Tree Searchrecursive2 problems · 2 core
Build a trie of words; query with prefix or backtracking traversal
▶DP16 patterns · 72 problems · 25 core
▶DP — 0/1 Knapsackdp11 problems · 2 core
Choose subset of items to maximize value within capacity
▶DP — Intervaldp4 problems · 2 core
dp[i][j] over interval (i,j); inner loop over split point k
▶Divide and Conquerrecursive1 problem · 1 core
Split into smaller subproblems, solve recursively, combine results
▶DP — 1Ddp23 problems · 2 core
dp[i] depends on a small fixed number of previous values
- ●Number of Ways to Decode a Message
- ●Divisor Game
- Extra practice
- ●DP with Dynamic Subproblems
- ●What is Dynamic Programming?
- ●House Robber
- ●Largest Divisible Subset
- ●Longest Increasing Subsequence
- ●Longest String Made Up Of Only Vowels
- ●Perfect Squares
- ●Triangle
- ●Ugly Number
- ●Word Break
- ●Climbing Stairseasy
- ●Fibonacci Numbereasy
- ●House Robber IImedium
- ●Longest Valid Parentheseshard
- ●Maximum Subarraymedium
- ●Word Break IIhard
- ●N-th Tribonacci Numbereasy
- ●Min Cost Climbing Stairseasy
- ●Minimum Cost For Tickets
- ●Partition Array for Maximum Summedium
- ●Longest String Chain
▶DP — 2D Griddp11 problems · 2 core
dp[i][j] depends on dp[i-1][j], dp[i][j-1] (or similar neighbors)
- ●Grid DP Introduction
- ●Maximal Square
- Extra practice
- ●Minimum Difficulty of a Job Schedule
- ●Minimum Path Sum
- ●Minimum Total Container Size
- ●Number of Unique Paths to Go from Top Left to Bottom Right
- ●Longest Palindromic Substringmedium
- ●Palindromic Substringsmedium
- ●Unique Pathsmedium
- ●Unique Paths II
- ●Dungeon Game
▶DP — Sequence (LCS-style)dp5 problems · 2 core
dp[i][j] over two strings/arrays; compares chars at i, j
▶Two Pointers — Mergeiterative1 problem · 1 core
Two pointers across two sorted inputs, advancing whichever is smaller
▶Graph — Grid BFS (Shortest Path)iterative2 problems · 2 core
BFS on a 2D grid using a queue, tracking distance
▶Greedy + Heapiterative1 problem · 1 core
Use heap to always pick the optimal element greedily
▶Greedy — Running Max/Min Trackingiterative4 problems · 2 core
Single pass; maintain running min/max and update answer greedily
▶Two Pointers — Opposite Endsiterative2 problems · 2 core
Two pointers starting at both ends, converging toward the middle
▶Backtracking — Generate Allrecursive1 problem · 1 core
Recursively build candidates; choose, recurse, undo (push/pop)
▶Binary Search — Boundary (First True)iterative1 problem · 1 core
Find the first index where a predicate becomes true (or last where it's false)
▶Binary Search — On Answer Spaceiterative2 problems · 2 core
Binary search over the answer values themselves; check feasibility at mid
▶Two Pointers — Same Direction (Slow/Fast)iterative1 problem · 1 core
Slow read pointer + fast write pointer (or different speeds), both moving forward
▶DP — State Machine (Decision)dp1 problem · 1 core
Track multiple dp states (e.g., holding/not-holding stock); transition between states each step
▶OOP/Design2 patterns · 9 problems · 4 core
▶Data Structure Designdesign3 problems · 2 core
Build a class supporting a defined set of operations efficiently
- ●LRU Cache
- ●Median of Data Stream
- Extra practice
- ●Playing Cards
▶Event Simulationiterative5 problems · 2 core
Step through events/time/state transitions in order, updating world state per step