Tagged: Numbers


Format the given number into an American currency format

Convert a given number into the formatted number. Logic Traverse the┬ástring in the reverse order Consider the following cases : Positive numbers, Negative numbers, Positive floating point numbers, Negative floating point numbers   Solution


Implement a power function

Naive logic: Loop through the number of times the exponent, and during each iteration multiply the base If our exponent is 10,000 then our loop has to run 10,000 times. But we can optimize...