/FooBar

Google's Foo Bar Challenge

Primary LanguageJava

Google's FooBar Challenge

Repo for my solutions in java.

Levels

Level 1:

Given a decimal number n, return the base b in which the number n is a palindrome. For example:

input: 10, output: 3 because (10)10 = (101)3 where (n)b is n base b.

Level 2.1:

Given n numbers in which each number represents the number of bunnies in a cart on a train, return the max number of carts that can have the same number of bunnies by moving bunnies from one cart to the other. For example

input: 8 12 5, output: 2 because the arragement 8 8 9 is the closest you can get to having a equal number of bunnies in each cart.

Level 2.2:

Given a list of words, sort them in decending order according to the following parameters. Words are ranked by calculating their scores as follows: if a = 1, b = 2, c = 3, and so on, a words score is the sum of the scores of its letters. If two words have the same score (AL = 13, CJ = 13), then the lexicographically larger word is ranked higher (so CJ). Here is an example:

input: [annie, bonnie, liz], output: [bonnie, liz, annie]