Monthly Archives: June 2008

Puzzle – shortest road system

Let’s say you’re contracted to build roads to connect four towns that are at the corners of an imaginary square with sides 1 mile. What’s the shortest length of road system you can build so that every town can get … Continue reading

Posted in puzzles | Tagged , | 4 Comments

Puzzle – Clock

It’s 3 O’Clock. What will be the time when the minute and hour hands are next in the same position (coincident)? One way to solve this problem:  start with the minute hand at the 12 and hour hand at the … Continue reading

Posted in puzzles | Tagged , , | 5 Comments

More puzzles…

Some of these are from Heard on the Street – a book of interview questions for Quants I’m trying to get through. Well worth a read if you’re into this sort of thing… 1. Two ropes of different lengths, and … Continue reading

Posted in puzzles | Tagged , , | 2 Comments

Mth to last – a recursive approach in Python

A collegue of mine was pondering the mthToLast problem for a LinkedList I’d blogged about previously and sent me the following IM message: just a guess – but can you use recursion to solve your link list m problem? a … Continue reading

Posted in programming | Tagged , , , | Leave a comment

Reverse a string using recursion in Python

I’ve always found recursion somewhat unnatural to think about, but somehow satisfying when I can see it unfolding in my mind – this simple exercise in reversing a string using recursion is a case in point… >>> def reverse(str): if … Continue reading

Posted in programming | Tagged , , | Leave a comment

Deep copy and recursive references

Quick one about coding a deep copy and avoiding recursive references… Let’s say we have an instance a which has a reference to an instance b and we have to do a deep copy of a. To do this, we … Continue reading

Posted in programming | Tagged , , | 3 Comments

Bootstrapping Zero Curves

What is a yield curve A yield curve is a representation of what interest rates you could lock in today for investments over different periods. It’s effectively a set of yields for securities of different maturities (typically cash rates at … Continue reading

Posted in finance | Tagged , , | 5 Comments

The “Mathematical Constant” and Continuously Compouding Interest

One of the (many) aspects of the “Mathematical Constant” is that: This property makes very useful for working on compounding interest problems. How so? Let’s start with the basic time value of money formula giving the relationship between the PV … Continue reading

Posted in finance | Tagged , , | Leave a comment

Puzzle – Alternating coin toss game

A really simple problem, but needs a trick or two to solve quickly. Question: You take it in turns tossing a coin with a friend – you having the first toss – and keep going until one of you tosses … Continue reading

Posted in mathematics, puzzles | Tagged , | Leave a comment

Puzzle – Roll a die for $

This is an interesting puzzle in that it shows a basic technique used in solving these kinds of probability puzzles, as well as in models for some derivatives pricing, without the need for conditional probability calculations. Hint: start with the … Continue reading

Posted in programming | Tagged , | Leave a comment