-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
117 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Introduction | ||
|
||
You've just been hired as professor of mathematics. | ||
Your first week went well, but something is off in your second week. | ||
The problem is that every answer given by your students is wrong! | ||
Luckily, your math skills have allowed you to identify the problem: the student answers _are_ correct, but they're all in base 2 (binary)! | ||
Amazingly, it turns out that each week, the students use a different base. | ||
To help you quickly verify the student answers, you'll be building a tool to translate between bases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Introduction | ||
|
||
Raindrops is a slightly more complex version of the FizzBuzz challenge, a classic interview question. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Introduction | ||
|
||
Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming. | ||
|
||
For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Description | ||
|
||
Today, most people in the world use Arabic numerals (0–9). | ||
But if you travelled back two thousand years, you'd find that most Europeans were using Roman numerals instead. | ||
|
||
To write a Roman numeral we use the following Latin letters, each of which has a value: | ||
|
||
| M | D | C | L | X | V | I | | ||
| ---- | --- | --- | --- | --- | --- | --- | | ||
| 1000 | 500 | 100 | 50 | 10 | 5 | 1 | | ||
|
||
A Roman numeral is a sequence of these letters, and its value is the sum of the letters' values. | ||
For example, `XVIII` has the value 18 (`10 + 5 + 1 + 1 + 1 = 18`). | ||
|
||
There's one rule that makes things trickier though, and that's that **the same letter cannot be used more than three times in succession**. | ||
That means that we can't express numbers such as 4 with the seemingly natural `IIII`. | ||
Instead, for those numbers, we use a subtraction method between two letters. | ||
So we think of `4` not as `1 + 1 + 1 + 1` but instead as `5 - 1`. | ||
And slightly confusingly to our modern thinking, we write the smaller number first. | ||
This applies only in the following cases: 4 (`IV`), 9 (`IX`), 40 (`XL`), 90 (`XC`), 400 (`CD`) and 900 (`CM`). | ||
|
||
Order matters in Roman numerals! | ||
Letters (and the special compounds above) must be ordered by decreasing value from left to right. | ||
|
||
Here are some examples: | ||
|
||
```text | ||
105 => CV | ||
---- => -- | ||
100 => C | ||
+ 5 => V | ||
``` | ||
|
||
```text | ||
106 => CVI | ||
---- => -- | ||
100 => C | ||
+ 5 => V | ||
+ 1 => I | ||
``` | ||
|
||
```text | ||
104 => CIV | ||
---- => --- | ||
100 => C | ||
+ 4 => IV | ||
``` | ||
|
||
And a final more complex example: | ||
|
||
```text | ||
1996 => MCMXCVI | ||
----- => ------- | ||
1000 => M | ||
+ 900 => CM | ||
+ 90 => XC | ||
+ 5 => V | ||
+ 1 => I | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,25 @@ | ||
# Instructions | ||
|
||
Given a word, compute the Scrabble score for that word. | ||
Your task is to compute a word's Scrabble score by summing the values of its letters. | ||
|
||
## Letter Values | ||
The letters are valued as follows: | ||
|
||
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 | | ||
|
||
```text | ||
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 | ||
``` | ||
|
||
## Examples | ||
|
||
"cabbage" should be scored as worth 14 points: | ||
For example, the word "cabbage" is worth 14 points: | ||
|
||
- 3 points for C | ||
- 1 point for A, twice | ||
- 3 points for B, twice | ||
- 1 point for A | ||
- 3 points for B | ||
- 3 points for B | ||
- 1 point for A | ||
- 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 | ||
|
||
## Extensions | ||
|
||
- You can play a double or a triple letter. | ||
- You can play a double or a triple word. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Introduction | ||
|
||
[Scrabble][wikipedia] is a word game where players place letter tiles on a board to form words. | ||
Each letter has a value. | ||
A word's score is the sum of its letters' values. | ||
|
||
[wikipedia]: https://en.wikipedia.org/wiki/Scrabble |