This week’s riddler express was a great level of difficulty, not too tough, but still a challenge! I thought it was worthy of a write-up. One of my goals is to make these posts enjoyable for everyone, not just the people who are puzzle crazy like I am. If you have tips for things you thought were confusing or difficult to understand, let me know. Hope you enjoy!
From Jerry Meyers, a careening commute problem:
Our co-workers carpool to work each day. A driver is selected randomly for the drive to work and again randomly for the drive home. Each of the drivers has a lead foot, and each has a chance of being ticketed for speeding. Driver A has a 10 percent chance of getting a ticket each time he drives, Driver B a 15 percent chance, Driver C a 20 percent chance, and Driver D a 25 percent chance. The state will immediately revoke the license of a driver after his or her third ticket, and a driver will stop driving in the carpool once his license is revoked. Since there is only one police officer on the carpool route, a maximum of one ticket will be issued per morning and a max of one per evening.
Assuming that all four drivers start with no tickets, how many days can we expect the carpool to last until all the drivers have lost their licenses?
First, let’s make some observations about the problem. At the beginning of each trip, each driver will have some amount of tickets. I’m going to refer to these amounts as a state. For example, if Drivers A & B each had 1 ticket, I’ll write that state as
[1, 1, 0, 0]. The intial state is
[0, 0, 0, 0] and the end state is
[3, 3, 3, 3] (all drivers are suspended).
Last week I won the FiveThityEight Riddler! (don’t get too excited, the winner is randomly selected 😉)
I don’t share every riddler I work on, but this one is straightforward yet interesting, politically applicable, and was fun to work on.
Imagine that U.S. Supreme Court nominees are only confirmed if the same party holds the presidency and the Senate. What is the expected number of vacancies on the bench in the long run?
You can assume the following:
- You start with an empty, nine-person bench.
- There are two parties, and each has a 50 percent chance of winning the presidency and a 50 percent chance of winning the Senate in each election.
- The outcomes of Senate elections and presidential elections are independent.
- The length of time for which a justice serves is uniformly distributed between zero and 40 years.
Additional clarifications I made:
I have omitted some of the code for brevity. Full code here
Today’s post is a (relatively) quick one to do some visualization on my financial data. Specifically, I was interested in whether some concious changes I had made in my dietary habits have materialized into measurable savings.
To date, I haven’t really focused too much on reducing my food spending. I keep a budget for it, but pretty regularly exceed it. However, in February I took a close look at how much I was actually spending and tried to take some steps to reduce my spending. The main areas that I looked to cut were eating take-out and getting breakfast & lunch at work every day. I’ve been making some concious efforts in those areas over the past ~4 weeks or so, including cooking large batch meals to bring for lunches at work.
In the post I’m going to run through the analysis I did to determine whether my changes had a financial impact.
Hello again everyone! This time, I’ll take a break from programming and tell you about another of my favorite things: podcasts. Podcasts are audio-only programs, spanning all types of genres. They are typically released on a regular schedule and free (mostly ad supported) and there’s something out there for everyone! If you want to read more about them, wikipedia has your back, as always: podcast. If you’re new and unsure how to listen, check out this helpful guide!
In this post I’m going to share three of my favorite shows, hopefully some that you don’t listen to already. For those who are familiar with podcasts, I’ve tried to stay away from some of the very popular shows like This American Life, Radiolab or Serial. If you have never listened to podcasts before, both of those shows are definitely worth checking out as well. Without further ado…
If you haven’t read my last post, go ahead and read that before diving in here. It’s not strictly necessary, but it will give you some context.
In my last post discussing high scoring Boggle boards, I skipped over some important details. Because I wanted to keep my focus on the genetics aspect of the solution, I didn’t walk through actually scoring the boards. A few people have asked me about the details, so I thought it’d be fun to share that as well. If your recreational reading is solely focused on Boggle board solving, there are