Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

All posts tagged math

Yield To Maturity calculation using a Python script

When interested in buying bonds a term that often comes up is the definition of Yield To Maturity (YTM): Yield to maturity (YTM) is the total return anticipated on a bond if the bond is held until the end of its lifetime. Yield to maturity is considered a long-term bond . . . Read more

Exponentiation by squaring

This is a rather short post. in which I explain how to we can implement a fast pow function to raise a number to the power of . A rather naive approach would be to do the following: int pow(int x, int n){ int result = 1; while (n > . . . Read more