- Create a square root function.
- Given a string such as "123" or "67", write a function to output the number represented by the string without using casting.
- Make a program that can print out the text form of numbers from 1 - 1000 (ex. 20 is "twenty", 105 is "one hundred and five").
- Write a function that parses Roman numerals.
- E.g.
XIV
returns14
.
- E.g.
- Write in words for a given digit.
- E.g.
123
returnsone hundred and twenty three
.
- E.g.
- Given a number
N
, find the largest number just smaller thanN
that can be formed using the same digits asN
. - Compute the square root of
N
without using any existing functions. - Given numbers represented as binary strings, and return the string containing their sum.
- E.g.
add('10010', '101')
returns'10111'
.
- E.g.
- Take in an integer and return its english word-format.
- E.g. 1 -> "one", -10,203 -> "negative ten thousand two hundred and three".
- Write a function that returns values randomly, according to their weight. Suppose we have 3 elements with their weights: A (1), B (1) and C (2). The function should return A with probability 25%, B with 25% and C with 50% based on the weights.
- Given a number, how can you get the next greater number with the same set of digits?