Parcourir la source

update readmes

Sam Warner il y a 8 ans
Parent
révision
9406ccacc8

+ 4
- 5
exercises/crypto-square/README.md Voir le fichier

45
 imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
45
 imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
46
 ```
46
 ```
47
 
47
 
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.
53
 
52
 
54
 ```text
53
 ```text
55
 imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn  sseoau 
54
 imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn  sseoau 

+ 38
- 0
exercises/error-handling/README.md Voir le fichier

9
 is rather programming language specific you'll have to refer to the tests
9
 is rather programming language specific you'll have to refer to the tests
10
 for your track to see what's exactly required.
10
 for your track to see what's exactly required.
11
 
11
 
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
+
12
 # Running the tests
50
 # Running the tests
13
 
51
 
14
 You can run all the tests for an exercise by entering
52
 You can run all the tests for an exercise by entering

+ 6
- 6
exercises/series/README.md Voir le fichier

1
 # Series
1
 # Series
2
 
2
 
3
 Given a string of digits, output all the contiguous substrings of length `n` in
3
 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.
5
 
5
 
6
 For example, the string "49142" has the following 3-digit series:
6
 For example, the string "49142" has the following 3-digit series:
7
 
7
 
8
-- 491
9
-- 914
10
-- 142
8
+- "491"
9
+- "914"
10
+- "142"
11
 
11
 
12
 And the following 4-digit series:
12
 And the following 4-digit series:
13
 
13
 
14
-- 4914
15
-- 9142
14
+- "4914"
15
+- "9142"
16
 
16
 
17
 And if you ask for a 6-digit series from a 5-digit string, you deserve
17
 And if you ask for a 6-digit series from a 5-digit string, you deserve
18
 whatever you get.
18
 whatever you get.

+ 5
- 3
exercises/sieve/README.md Voir le fichier

5
 
5
 
6
 The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
6
 The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
7
 prime numbers up to any given limit. It does so by iteratively marking as
7
 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.
10
 
10
 
11
 Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit])
11
 Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit])
12
 
12
 
25
 
25
 
26
 Notice that this is a very specific algorithm, and the tests don't check
26
 Notice that this is a very specific algorithm, and the tests don't check
27
 that you've implemented the algorithm, only that you've come up with the
27
 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).
29
 
31
 
30
 # Running the tests
32
 # Running the tests
31
 
33