Not all the verses are the same.
99 bottles of beer on the wall, 99 bottles of beer. Take one down and pass it around, 98 bottles of beer on the wall. 98 bottles of beer on the wall, 98 bottles of beer. Take one down and pass it around, 97 bottles of beer on the wall. 97 bottles of beer on the wall, 97 bottles of beer. Take one down and pass it around, 96 bottles of beer on the wall. … … 2 bottles of beer on the wall, 2 bottles of beer. Take one down and pass it around, 1 bottle of beer on the wall. 1 bottle of beer on the wall, 1 bottle of beer. Take it down and pass it around, no more bottles of beer on the wall. No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.
Joe answers 'Sure.' if you ask him a question.
He answers 'Whoa, chill out!' if you yell at him.
He answers 'Calm down, I know what I’m doing!' if you do both.
He says 'Fine. Be that way!' if you address him without actually saying
anything.
He answers 'Whatever.' to anything else.
The tricky thing here is that a leap year in the Gregorian calendar occurs:
on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
unless the year is also evenly divisible by 400For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap year, but 2000 is.
If your language provides a method in the standard library that does this look-up, pretend it doesn’t exist and implement it yourself.
The rules are as follows:
-
If the phone number is less than 10 digits assume that it is bad number
-
If the phone number is 10 digits assume that it is good
-
If the phone number is 11 digits and the first number is 1, trim the 1 and use the last 10 digits
-
If the phone number is 11 digits and the first number is not 1, then it is a bad number
-
If the phone number is more than 11 digits assume that it is a bad number
We’ve provided tests, now make them pass.
A mutation is simply a mistake that occurs during the creation or copying of a nucleic acid, in particular DNA. Because nucleic acids are vital to cellular functions, mutations tend to cause a ripple effect throughout the cell. Although mutations are technically mistakes, a very rare mutation may equip the cell with a beneficial attribute. In fact, the macro effects of evolution are attributable by the accumulated result of beneficial microscopic mutations over many generations.
The simplest and most common type of nucleic acid mutation is a point mutation, which replaces one base with another at a single nucleotide.
By counting the number of differences between two homologous DNA strands taken from different genomes with a common ancestor, we get a measure of the minimum number of point mutations that could have occurred on the evolutionary path between the two strands.
This is called the `Hamming distance'.
It is found by comparing two DNA strands and counting how many of the nucleotides are different from their equivalent in the other string.
GAGCCTACTAACGGGAT CATCGTAATGACGGCCT ^ ^ ^ ^ ^ ^^
The Hamming distance between these two DNA strands is 7.
Given an age in seconds, calculate how old someone would be on:
-
Earth: orbital period 365.25 Earth days, or 31557600 seconds
-
Mercury: orbital period 0.2408467 Earth years
-
Venus: orbital period 0.61519726 Earth years
-
Mars: orbital period 1.8808158 Earth years
-
Jupiter: orbital period 11.862615 Earth years
-
Saturn: orbital period 29.447498 Earth years
-
Uranus: orbital period 84.016846 Earth years
-
Neptune: orbital period 164.79132 Earth years
-
Pluto: orbital period 247.94 Earth years
So if you were told someone were 1,000,000,000 seconds old, you should be able to say that they’re 31 Earth-years old.
For example, for the input '1027839564', the largest product for a series of 3
digits is 270 (9 * 5 * 6), and the largest product for a series of 5 digits is
7560 (7 * 8 * 3 * 9 * 5).
Note that these series are only required to occupy adjacent positions in the input; the digits need not be numerically consecutive.
For the input '73167176531330624919225119674426574742355349194934', the
largest product for a series of 6 digits is 23520.
You’ll need these:
Letter Value
A, E, I, O, U, L, N, R, S, T 1
D, G 2
B, C, M, P 3
F, H, V, W, Y 4
K 5
J, X 8
Q, Z 10``cabbage'' should be scored as worth 14 points:
-
3 points for C
-
1 point for A, twice
-
3 points for B, twice
-
2 points for G
-
1 point for E
And to total:
-
3 + 2*1 + 2*3 + 2 + 1 -
=
3 + 2 + 6 + 3 -
=
5 + 9 -
= 14