Notes on studying.
How people really learn, studying with a friend, and what we’re building into Pen Buddy.
Each post starts from the research on learning, with its sources, and ends with something to try in your next study session. For step-by-step how-tos and fair comparisons of study tools, see the guides.
- November 28, 2026
The prosecutor's fallacy: a DNA match that is probably innocent
The prosecutor's fallacy with a city of a million: 1 innocent in 100,000 matches, yet 10 of the 11 people who match are innocent, about 91%.
Read - November 28, 2026
Why dereferencing a null pointer crashes in C++
A null pointer in C++ is 8 zero bytes: address 0. On x86-64 Linux nothing is mapped there, so *p faults and the kernel sends SIGSEGV.
Read - November 28, 2026
Search in Rotated Sorted Array in Python (LeetCode 33)
Search in Rotated Sorted Array works because one half is always sorted: find it, check if the target is inside. LeetCode 33 in Python.
Read - November 27, 2026
Pointer arithmetic in C++: why p + 1 moves 4 bytes, not 1
Pointer arithmetic in C++ moves an address by n times the size of the type. One real run: int* p + 1 moves 4 bytes, char* c + 1 moves 1.
Read - November 27, 2026
Binary Search on the Answer: Koko Eating Bananas in Python
Binary search on the answer tests the middle of the possible answers and keeps the half that works. LeetCode 875, Koko Eating Bananas, in Python.
Read - November 27, 2026
The taxi cab problem: a witness says the cab was blue. Was it?
The taxi cab problem with 100 cabs: a witness who is right 80% of the time says blue, yet only 12 of the 29 cabs called blue are blue: about 41%.
Read - November 26, 2026
Dereferencing a pointer in C++: what *p reads, byte by byte
Dereferencing a pointer in C++ reads or writes the bytes at its address; the type says how many. One real run: *p reads 4 bytes, *q reads 1.
Read - November 26, 2026
Binary Search in Python: Halving a Phone Book (LeetCode 704)
Binary search finds a value in a sorted list by halving what's left each look: 1,000 pages in at most 10 looks. LeetCode 704 in Python.
Read - November 26, 2026
Bayes' rule with dots: is an email that says free spam?
Bayes' rule without a formula: lay out 40 emails, keep only the ones that say free, and count. 5 of the 8 that are left are spam, so 5 in 8.
Read - November 25, 2026
What is a pointer in C++? 8 bytes that hold an address
What is a pointer in C++? A variable whose 8 bytes hold another object's address, lowest byte first. One real run, byte by byte, with the program.
Read - November 25, 2026
Subarray Sum Equals K in Python: Prefix Sums and a Hash Map
Subarray Sum Equals K (LeetCode 560): pin every running total on a tape, and a slice adds to k when two marks are k apart. One pass, O(n).
Read - November 25, 2026
The false positive paradox: a 99% accurate test, 9% sick
A 99% accurate test for a disease 1 in 1,000 people have: you test positive. Lay out 1,000 people and count: only about 9% of positives are sick.
Read - November 23, 2026
Minimum Window Substring, a Sliding Window with Counts
Minimum Window Substring (LeetCode 76): a Counter of what's still needed, grow on the right, shrink on the left while nothing is missing.
Read - November 23, 2026
Permutations vs combinations: 6 orders on a shelf, 1 set in a bag
Permutations vs combinations with three books: 6 orders on a shelf, 1 set in a bag, and why you divide by the repeats when order doesn't matter.
Read - November 23, 2026
Struct memory layout in C++: the real bytes, offsets and padding
Struct memory layout in C++, byte by byte: char, short, int in 8 bytes, one padding byte, and a real dump read low byte first: 41 00 02 01 e8 03 00 00.
Read - November 22, 2026
Struct padding in C++: alignment and why sizeof is bigger
Struct padding in C++, byte by byte: char, int, char holds 6 bytes of data but sizeof is 12. Put the int first and the same members fit in 8.
Read - November 22, 2026
Longest Substring Without Repeating Characters, Sliding Window
Longest Substring Without Repeating Characters (LeetCode 3): grow the window on the right, shrink it on the left at a repeat. O(n).
Read - November 22, 2026
Probability of a full house: counting all 3,744 hands
The probability of a full house in five-card poker, counted box by box: 13 × 4 × 12 × 6 = 3,744 of 2,598,960 hands, about 1 in 694.
Read - November 21, 2026
Implicit conversions in C++, byte by byte
Implicit conversions in C++ change the bytes: int 7 becomes 401C000000000000 as a double, char + char is an int, and int 300 narrows to char 44.
Read - November 21, 2026
3Sum (LeetCode 15) in Python: Sort and Two Pointers
3Sum (LeetCode 15): sort, fix one number, walk two pointers over the rest, and skip repeats. Every zero-sum triple once, in O(n²).
Read - November 21, 2026
The birthday paradox: why 23 people are enough
The birthday paradox: in a room of 23 people a shared birthday is more likely than not. Count the 253 pairs and play it out person by person.
Read - November 20, 2026
sizeof(bool) in C++: why a bool is a whole byte
A C++ bool holds one bit of information but takes a whole byte. The raw bytes are 01 for true and 00 for false, and 8 bools take 8 bytes.
Read - November 20, 2026
Container With Most Water (LeetCode 11) in Python
Container With Most Water (LeetCode 11): a pointer at each end, measure the water, keep the best, move the shorter wall in. One pass, O(n).
Read - November 20, 2026
The three cards problem: why the back is red 2 in 3
The three cards problem: red-red, white-white and red-white. You see a red face. Lay out all six faces and the back is red 2 times in 3.
Read - November 19, 2026
char and ASCII in C++: a char is a one-byte integer
A C++ char is one byte holding a number. The real bytes of "cat" are 63 61 74 00, and subtracting 32 from the first one prints Cat.
Read - November 19, 2026
Two Sum II (LeetCode 167): two pointers on a sorted array
Two Sum II (LeetCode 167): a pointer at each end of the sorted array, too heavy moves right one left, too light moves left one right. O(n), O(1).
Read - November 19, 2026
The boy born on a Tuesday problem: why the answer is 13/27
The boy born on a Tuesday problem: two kids, at least one a boy born on a Tuesday. Count 196 families and 13 of the 27 left have two boys.
Read - November 18, 2026
Why 0.1 + 0.2 != 0.3 in C++: the bits of 0.1
0.1 + 0.2 == 0.3 is false in C++. The real 64 bits of 0.1 show why: its mantissa is 1001 repeating, cut off at 52 bits and rounded up.
Read - November 18, 2026
Valid Palindrome in Python with two pointers (LeetCode 125)
Valid Palindrome (LeetCode 125) with two pointers: walk inward from both ends, skip punctuation, compare in lower case. O(n) time, O(1) space.
Read - November 18, 2026
The boy-girl paradox: why the answer is 1 in 3
The boy-girl paradox: of all two-child families with at least one boy, what fraction have two boys? Count the four families: 1 in 3.
Read - November 17, 2026
At least one six in four rolls: de Méré's bet, counted
Roll a die four times: is at least one six more likely than not? Count the rolls with no six instead, and 671 of the 1296 sequences win.
Read - November 17, 2026
How a double is stored in C++: sign, exponent and mantissa
The real eight bytes of -6.25 in memory, read as 64 bits and split into the IEEE-754 fields: 1 sign bit, 11 exponent bits, 52 mantissa bits.
Read - November 17, 2026
Hash maps in Python: why dictionary lookups are O(1)
How a hash map finds one key among millions in one step: hash the key to a bucket, jump there, compare. Collisions included, in 14 lines of Python.
Read - November 16, 2026
C++ integer overflow: unsigned wraps, signed is undefined
Integer overflow on real bytes: why 0xff + 1 is 0 in a uint8_t, why unsigned always wraps mod 2^N, and why INT_MAX + 1 is undefined behaviour.
Read - November 16, 2026
Two Sum in Python with a hash map, in one pass
Two Sum (LeetCode 1) in one pass: each number asks a dictionary whether its partner was already seen. O(n) instead of checking every pair.
Read - November 16, 2026
Most common sum of two dice: why 7 wins (count the 36 pairs)
Roll two dice and add them: 7 comes up more than any other sum. Lay out all 36 pairs and the diagonals show why: 6 pairs make 7.
Read - November 15, 2026
Probability of at least one six with two dice: count the 36 cases
Roll two dice: what's the chance at least one shows a six? Lay out all 36 equally likely pairs and count: 11 out of 36, not 1 in 3.
Read - November 15, 2026
The Monty Hall problem, explained by playing out every case
Three doors, one car, the host opens a goat. Lay out every case where the car can be and see why switching wins 2 times out of 3.
Read - November 15, 2026
Two's complement: why -1 is 0xFFFFFFFF, and what unsigned changes
Two's complement explained on real bytes: why -1 is four bytes of ff, why the same bytes read as 4294967295 unsigned, and how -5 becomes fffffffb.
Read - November 15, 2026
Array insertion time complexity, shown with lockers
An array keeps its slots side by side like a corridor of lockers. See why reading any item is one jump, and why an insert shifts everything after it.
Read - November 6, 2026
Quiz Me on My Notes: 3 Ways to Test Your Recall
Learn how to turn your class notes into practice questions using chatbot prompts, flashcard tools, and spoken recall.
Read - November 6, 2026
Studying Alone vs Studying Group: What Works Better?
Compare studying alone vs studying in a group. Learn what cognitive science shows about solo retrieval practice, group accountability, and study partners.
Read - November 3, 2026
How to Use AI to Study for Exams
Learn how to use AI to study for exams effectively using Socratic prompts, step-checking, and retrieval practice without hurting your test scores.
Read - November 3, 2026
How to Take Math Notes on a Laptop
Learn how to take math notes on a laptop using live Markdown, LaTeX shortcuts, and strategies that boost conceptual recall.
Read - November 2, 2026
How to Study Proof Based Math After Computation
Learn how to study proof based math classes, use self-explanation to master theorems, and practice writing proofs from scratch.
Read - November 2, 2026
How to Learn Dynamic Programming from Scratch
Learn dynamic programming from scratch by moving from recursion to memoization to tables, using proven frameworks from Cormen and MIT.
Read - November 2, 2026
The Best Notability Alternatives for Students
Looking for Notability alternatives? Compare Goodnotes, Apple Notes, Noteful, and AI notebooks to find the right tool for your iPad and Mac notes.
Read - November 2, 2026
How to Remember What You Study for the Long Term
Learn how to remember what you study by using retrieval practice and spaced repetition instead of re-reading.
Read - October 18, 2026
How to Use the Self Explanation Effect
Learn how the self explanation effect works, why talking through problem steps improves your recall, and how to practice it on your own.
Read - October 16, 2026
Dunlosky et al. 2013: Which Study Techniques Work
Dunlosky et al. (2013) reviewed ten learning techniques. Here is what the evidence says about practice testing, distributed practice, and rereading.
Read - October 16, 2026
Do AI Study Apps Actually Work?
AI study apps work well when they quiz you and give hints, but hurt exam scores when they solve problems for you. Here is what research shows.
Read - October 16, 2026
Testing Effect Psychology Example: The 2006 Study
Learn the testing effect psychology example from Roediger and Karpicke (2006) and how retrieval practice improves memory over re-reading.
Read