Topic notes
Learning notes
Programming exercises, AI reading notes, and engineering workflow notes.
For readers practicing programming fundamentals. Start with the TypeScript problems that match your current topic; the list records learning rather than a prerequisite chain. Read the AI and Git notes independently.
Topic notes
What Happens When a JavaScript Function Runs? Execution Context and Local Memory
Trace JavaScript function calls, parameters, return values, and local variables with original examples, then see how closures preserve state.
JavaScript Callbacks and Higher-Order Functions: Passing Behavior as an Argument
Build a reusable array transformation to understand callbacks, higher-order functions, map, arrow functions, mutation, and shallow copies.
JavaScript Closures: How Functions Remember Outer Variables
Use counters to explore closures and lexical scope, shared and independent state, and memory cleanup.
What Is Prompt Engineering? Turning a Question into a Testable Task
Notes from Practical Prompt Engineering: use a JavaScript closure example to understand prompts, context, output requirements, and repeatable checks.
Temperature and Top P: How a Model Selects the Next Token
Practical Prompt Engineering notes: use a five-token probability example to understand temperature, nucleus sampling, Top P 0.5, and the limits of consistent output.
Token Limits and Context Windows: What Can the Model See in This Turn?
Practical Prompt Engineering notes: distinguish tokens from words, context from output limits, and conversation history from memory, with a worked token budget.
Standard Prompts: Start with a Clear Request
A short Practical Prompt Engineering note: improve a newsletter-form request with context, constraints, targeted clarification, and concrete checks.
Core Prompting Techniques: When Should I Add Examples?
When one instruction isn't enough, should you add rules or examples? Compare standard, zero-shot, one-shot, and few-shot prompts using GitHub issues.
Context Placement: Where Should the Important Bits Go?
You supplied the context, but the answer missed it. Explore information placement, long documents, conversation summaries, and ways to test each change separately.
Structured Output: The AI Returned JSON. Now What?
Compare format prompts, JSON mode, and schema constraints. Use metadata checks, timestamps, and a token-estimation counterexample to see what the application still needs to validate.
ArtInt Reading Notes: Intelligent Agents and the AI Basics I Mixed Up
Notes on ArtInt 3e sections 1.1–1.2: agents, computability, and corrections to my understanding of decision trees, reinforcement learning, early language systems, and text generation.
LeetCode 128: Longest Consecutive Sequence in TypeScript
Move from sorting to a Set, expand only sequence starts, and give a rigorous expected O(n) analysis for the longest consecutive sequence problem.
LeetCode 56: Merge Intervals in TypeScript
Derive a TypeScript merge-intervals solution through sorting, one linear scan, input immutability, and an honest O(n log n) complexity analysis.
LeetCode 1480: Running Sum in TypeScript
Use each completed array position as state for one linear scan, with an honest discussion of in-place mutation, the loop invariant, and O(n) time.
LeetCode 1732: Find the Highest Altitude in TypeScript
Track current altitude and the highest altitude so far in one scan with O(n) time and O(1) auxiliary space.
LeetCode 724: Find a Pivot Index in TypeScript
Find the leftmost pivot index with a total sum and one running left sum, then make the loop invariant and O(n) analysis explicit.
LeetCode 2574: Left and Right Sum Differences in TypeScript
Compare stored left and right sums with a single scan, including output space, auxiliary space, and the loop invariant.
LeetCode 121: Best Time to Buy and Sell Stock in TypeScript
Replace nested transaction checks with one scan that tracks the lowest purchase price, including the correctness argument for a two-pointer solution and its O(n) cost.
LeetCode 217: Contains Duplicate in TypeScript with a Set
Compare a Set's size with the array length, or stop early during one scan, while explaining the Set solution's correctness and expected O(n) complexity.
LeetCode 1: Two Sum in TypeScript with a Map
Replace nested pair checks with a Map of earlier values and indices, then explain complement lookup, the loop invariant, and expected O(n) time.
LeetCode 242: Valid Anagram in TypeScript, From Sorting to Character Counts
Compare sorting, Map-based frequency differences, and a fixed-size count array for Valid Anagram, including correctness, invariants, and complexity.
LeetCode 49: Group Anagrams in TypeScript, From Sorting Keys to Count Signatures
Work through a sorting-based Group Anagrams solution, its repeated-array-copy cost, and a count signature for the fixed lowercase alphabet.
LeetCode 347: Top K Frequent Elements in TypeScript, From Frequency Sorting to Buckets
Start with Map frequency counting and sorting, then remove the O(n log n) sort with frequency buckets.
LeetCode 3: Longest Substring Without Repeating Characters in TypeScript
Keep an initial reset-and-rescan attempt, explain its O(n²) limit, then use a one-pass Map sliding window.
LeetCode 424: Longest Repeating Character Replacement in TypeScript
Keep the submitted frequency-counting sliding-window solution and explain why maxFreq can retain its historical maximum.
LeetCode 125: Valid Palindrome in TypeScript, From Cleaning to In-Place Two Pointers
Keep the submitted cleaned-string solution, then explain an in-place charCodeAt-based two-pointer alternative.
LeetCode 11: Container With Most Water in TypeScript, Why Move the Shorter Side?
My two-pointer solution, with a brute-force comparison, a proof for discarding the shorter side, and executable checks for O(n) time and O(1) extra space.
LeetCode 15: 3Sum in TypeScript, Why Skipping Duplicates Does Not Lose Answers
My progression from a global Set that loses answers to two pointers, with an explanation of all three duplicate checks, complexity, and executable assertions.
LeetCode 238: Product of array except self with prefix and suffix products
My division-based solution and prefix/suffix version, with zero handling, loop invariants, executable tests, and the difference between extra and output space.
LeetCode 53: Maximum subarray without rescanning every starting point
My O(n²) backward scan and final O(n) solution, with the distinction between endingHere and best, all-negative inputs, loop invariants, and executable tests.
LeetCode 152: Why maximum product subarray needs both extremes
My Maximum Product Subarray attempt, the counterexample that broke it, and the final O(n) maximum-and-minimum state solution with an invariant and brute-force checks.
LeetCode 70: Climbing stairs from repeated recursion to two rolling states
My Climbing Stairs path from a factorial dead end and exponential recursion to an O(n)-time, O(1)-extra-space rolling-state solution.
LeetCode 198: House Robber with take-or-skip rolling states
My House Robber solution, why its p1 and p2 updates work, and a clearer O(n)-time, O(1)-extra-space rolling-state version.
Git Merge vs Rebase: Which Should You Use?
Learn how Git merge and rebase change commit history, when each workflow fits, and how to avoid rewriting shared branches or creating needless conflicts.