math

Marksman Probability Puzzle

Marksman Probability Puzzle

Bruce Ediger

Found a puzzle on the notorious Futility Closet web site.

Here’s Futility Closet’s puzzle. Mr or Ms Closet decided to call the puzzle “Gun Control”. I don’t know if they chose the title to skirt controversy or something.

Problem Statement

Marksman A hits a certain small target 75 percent of the time. Marksman B hits it 25 percent of the time. The two of them aim at that target and fire simultaneously. One bullet hits it. What’s the probability that it came from A?

Count number of heaps coding problem

Count number of heaps coding problem

Bruce Ediger

Another programming interview question from the Daily Coding Problem email list. I received it as #1608.

Daily Coding Problem: Problem #1608 [Medium]

This problem was asked by Microsoft.

Write a program to determine how many distinct ways there are to create a max heap from a list of N given integers.

For example, if N = 3, and our integers are [1, 2, 3], there are two ways, shown below.

  3      3
 / \    / \
1   2  2   1

Repo for my code.

Smullyan's clever solutions

Bruce Ediger

In my post about Raymond Smullyan’s Og and Bog puzzle, I wrote:

Smullyan has a clever solution in the back of Logical Labyrinths, but I’m going to whittle the puzzle down to a size I can hold in my head, because I like procedures to solve puzzles. Having a procedure keeps me from making mistakes, and developing the procedure helps me understand the underpinnings of all problems.

I thought of something that makes Smullyan smarter than I believed.