Skip to content

Commit 9406cca

Browse files
committed
update readmes
1 parent b111382 commit 9406cca

4 files changed

Lines changed: 53 additions & 14 deletions

File tree

‎exercises/crypto-square/README.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ The message above is coded as:
4545
imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
4646
```
4747

48-
Output the encoded text in chunks. Phrases that fill perfect rectangles
49-
`(r X c)` should be output `c` chunks of `r` length, separated by spaces.
50-
Phrases that do not fill perfect rectangles will have `n` empty spaces.
51-
Those spaces should be distributed evenly, added to the end of the last
52-
`n` chunks.
48+
Output the encoded text in chunks that fill perfect rectangles `(r X c)`,
49+
with `c` chunks of `r` length, separated by spaces. For phrases that are
50+
`n` characters short of the perfect rectangle, pad each of the last `n`
51+
chunks with a single trailing space.
5352

5453
```text
5554
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau

‎exercises/error-handling/README.md‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,44 @@ This exercise requires you to handle various errors. Because error handling
99
is rather programming language specific you'll have to refer to the tests
1010
for your track to see what's exactly required.
1111

12+
# Java Tips
13+
14+
This exercise requires you to handle exceptions. An [exception](https://docs.oracle.com/javase/tutorial/essential/exceptions/definition.html) is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.
15+
16+
In Java, there are two types of exceptions: checked and unchecked exceptions.
17+
18+
- [Checked vs Unchecked Exceptions in Java](https://www.geeksforgeeks.org/checked-vs-unchecked-exceptions-in-java/)
19+
20+
- [Unchecked Exceptions — The Controversy](https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html)
21+
22+
## Checked exceptions
23+
24+
Checked exceptions are the exceptions that are checked at [compile time](https://en.wikipedia.org/wiki/Compile_time).
25+
26+
### Practical implications
27+
28+
You have to declare them in the [method signature](https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html) of any method that can [throw](https://docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html) a checked exception and handle or rethrow them when calling any method that can throw a checked exception.
29+
30+
This is because checked exceptions are meant to be handled at runtime, i.e. they are errors you can recover from.
31+
32+
### Examples of where they are used
33+
34+
They're often used when a method can't return any valid result, for example a search method which hasn't found the item it was searching for.
35+
36+
It's an alternative to returning null or a error code. A checked exception is better than those alternatives because it forces the user of the method to consider the error case.
37+
38+
## Unchecked exceptions
39+
40+
Unchecked exceptions are the exceptions that are not checked at [compile time](https://en.wikipedia.org/wiki/Compile_time).
41+
42+
### Practical implications
43+
44+
You don't have to declare them in the [method signature](https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html) of methods that can [throw](https://docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html) an unchecked exception and handle or rethrow them when calling any method that can throw an unchecked exception.
45+
46+
### Examples of where they are used
47+
48+
Unchecked exceptions are mean to be used for any error than can't be handled at runtime, e.g. running out of memory.
49+
1250
# Running the tests
1351

1452
You can run all the tests for an exercise by entering

‎exercises/series/README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Series
22

33
Given a string of digits, output all the contiguous substrings of length `n` in
4-
that string.
4+
that string in the order that they appear.
55

66
For example, the string "49142" has the following 3-digit series:
77

8-
- 491
9-
- 914
10-
- 142
8+
- "491"
9+
- "914"
10+
- "142"
1111

1212
And the following 4-digit series:
1313

14-
- 4914
15-
- 9142
14+
- "4914"
15+
- "9142"
1616

1717
And if you ask for a 6-digit series from a 5-digit string, you deserve
1818
whatever you get.

‎exercises/sieve/README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ number.
55

66
The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
77
prime numbers up to any given limit. It does so by iteratively marking as
8-
composite (i.e. not prime) the multiples of each prime,
9-
starting with the multiples of 2.
8+
composite (i.e. not prime) the multiples of each prime, starting with the
9+
multiples of 2. It does not use any division or remainder operation.
1010

1111
Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit])
1212

@@ -25,7 +25,9 @@ https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
2525

2626
Notice that this is a very specific algorithm, and the tests don't check
2727
that you've implemented the algorithm, only that you've come up with the
28-
correct list of primes.
28+
correct list of primes. A good first test is to check that you do not use
29+
division or remainder operations (div, /, mod or % depending on the
30+
language).
2931

3032
# Running the tests
3133

0 commit comments

Comments
 (0)