I've been subscribed to Interview Cake for years, and today they had a really interesting question: Given a list of n + 1 integers in the range 1...n, find one of the duplicates (there is guaranteed to be at least one) in O(n) time and O(1) additional …
It's worth it to use more memory
There's a common programming interview question that asks you to find the single non-duplicated value in a list of duplicated integers. This can be done in O(n) time and O(1) space by XOR'ing the values, and doing so is almost always the wrong answer. A better solution …
The problem with wealth taxes
Elizabeth Warren recently proposed a wealth tax as part of her plan to partially pay for single-payer healthcare. I think this is significantly worse than other methods of raising the same amount of revenue from the same group of people, so this article describes the problems with wealth …
Indexing and sorting to find data quickly
A reader emailed me asking how to quickly find pieces of data without needing to fully read every data file they have. I thought the answer could be interesting to other people, so I'll answer it both in theory and what I would do in practice.
To make your data …
How to write examples for documentation
When you're documenting a project so other people can use it, whether it's a library or web service, one important thing to do is to give people good examples to work with. Not only does this save people time trying to cobble together their first working program, but it's also …