diff --git a/exercises/practice/binary-search/.docs/instructions.md b/exercises/practice/binary-search/.docs/instructions.md index f183061e0..12f4358eb 100644 --- a/exercises/practice/binary-search/.docs/instructions.md +++ b/exercises/practice/binary-search/.docs/instructions.md @@ -5,9 +5,9 @@ Your task is to implement a binary search algorithm. A binary search algorithm finds an item in a list by repeatedly splitting it in half, only keeping the half which contains the item we're looking for. It allows us to quickly narrow down the possible locations of our item until we find it, or until we've eliminated all possible locations. -```exercism/caution +~~~~exercism/caution Binary search only works when a list has been sorted. -``` +~~~~ The algorithm looks like this: diff --git a/exercises/practice/bob/.approaches/answer-array/content.md b/exercises/practice/bob/.approaches/answer-array/content.md index e6fb6fb15..61cf9536e 100644 --- a/exercises/practice/bob/.approaches/answer-array/content.md +++ b/exercises/practice/bob/.approaches/answer-array/content.md @@ -33,10 +33,10 @@ The correct answer is selected from the array by using the score as the array in The `String` [`trim()`][trim] method is applied to the input to eliminate any whitespace at either end of the input. If the string has no characters left, it returns the response for saying nothing. -```exercism/caution +~~~~exercism/caution Note that a `null` `string` would be different from a `String` of all whitespace. A `null` `String` would throw a `NullPointerException` if `trim()` were applied to it. -``` +~~~~ A [Pattern][pattern] is defined to look for at least one English alphabetic character. diff --git a/exercises/practice/bob/.approaches/if-statements/content.md b/exercises/practice/bob/.approaches/if-statements/content.md index cb7bb835b..4c3791fc1 100644 --- a/exercises/practice/bob/.approaches/if-statements/content.md +++ b/exercises/practice/bob/.approaches/if-statements/content.md @@ -40,10 +40,10 @@ Execution will either return or will continue to the next statement anyway. The `String` [`trim()`][trim] method is applied to the input to eliminate any whitespace at either end of the input. If the string has no characters left, it returns the response for saying nothing. -```exercism/caution +~~~~exercism/caution Note that a `null` `string` would be different from a `String` of all whitespace. A `null` `String` would throw a `NullPointerException` if `trim()` were applied to it. -``` +~~~~ A [Pattern][pattern] is defined to look for at least one English alphabetic character. diff --git a/exercises/practice/collatz-conjecture/.approaches/intstream-iterate/content.md b/exercises/practice/collatz-conjecture/.approaches/intstream-iterate/content.md index 22bf8c4b1..cb0f0abdc 100644 --- a/exercises/practice/collatz-conjecture/.approaches/intstream-iterate/content.md +++ b/exercises/practice/collatz-conjecture/.approaches/intstream-iterate/content.md @@ -27,12 +27,12 @@ Another lambda is used to process the input number. [Bitwise operators][bitwise-operators] are used to check if the number is odd and to divide it in half if it is even. The bitwise AND operator (`&`) compares the number with `1` to see if it is odd. -```exercism/note +~~~~exercism/note Another way to go about checking if the number is even or odd is to see if it is evenly divided by `2` by using the [modulo (also know as the remainder) operator](https://www.geeksforgeeks.org/modulo-or-remainder-operator-in-java/). So, to see if it is even we could use `start % 2 == 0`. That might be slightly less performant but perhaps more readable for intent, especially for those who don't "speak binary". -``` +~~~~ If the number is even, then the right shift operator (`>>`) shifts all of the bits once to the right, which is the equivalent of dividing the number by `2`. diff --git a/exercises/practice/collatz-conjecture/.approaches/while-loop/content.md b/exercises/practice/collatz-conjecture/.approaches/while-loop/content.md index 1f362c080..8c4df5184 100644 --- a/exercises/practice/collatz-conjecture/.approaches/while-loop/content.md +++ b/exercises/practice/collatz-conjecture/.approaches/while-loop/content.md @@ -30,12 +30,12 @@ If the number is already `1` before control flow gets to the `while` loop, then [Bitwise operators][bitwise-operators] are used to check if the number is odd and to divide it in half if it is even. The bitwise AND operator (`&`) compares the number with `1` to see if it is odd. -```exercism/note +~~~~exercism/note Another way to go about checking if the number is even or odd is to see if it is evenly divided by `2` by using the [modulo (also know as the remainder) operator](https://www.geeksforgeeks.org/modulo-or-remainder-operator-in-java/). So, to see if it is even we could use `if (start % 2 == 0)`. That might be slightly less performant but perhaps more readable for intent, especially for those who don't "speak binary". -``` +~~~~ If the number is even, then the right shift equals operator (`>>=`) shifts all of the bits once to the right, which is the equivalent of dividing the number by `2`. diff --git a/exercises/practice/darts/.approaches/doublepredicate/content.md b/exercises/practice/darts/.approaches/doublepredicate/content.md index 5f5733743..569143783 100644 --- a/exercises/practice/darts/.approaches/doublepredicate/content.md +++ b/exercises/practice/darts/.approaches/doublepredicate/content.md @@ -33,22 +33,22 @@ Then the radius of the dart throw is calculated and assigned to a variable. A `DoublePredicate` is defined as a [lambda][lambda] that takes in a `double` value that represents the ring radius and compares it with the dart throw radius. -```exercism/note +~~~~exercism/note Although the dart throw radius is not directly passed to the lambda, the lambda can use it. To do so is called [capturing](https://www.geeksforgeeks.org/java-lambda-expression-variable-capturing-with-examples/) the variable. To capture a variable, it must be in the enclosing [scope](https://www.geeksforgeeks.org/variable-scope-in-java/) of the lambda, and it must be effectively `final`, meaning that is is not changed in the course of the program. -``` +~~~~ -```exercism/note +~~~~exercism/note The reason `DoublePredicate` is used instead of `Predicate` is to avoid the [autoboxing](https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html) that `Predicate` would do. `DoublePredicate` handles its primitive `double` argument without boxing it. This is also why the lambda is required to be given a specific target type instead of `var`, since the same lambda could be used for either `DoublePredicate` or `Predicate`. -``` +~~~~ A series of calls to the `DoublePredicate` is then made. diff --git a/exercises/practice/difference-of-squares/.approaches/intstream/content.md b/exercises/practice/difference-of-squares/.approaches/intstream/content.md index 8698520c8..e197bb3ce 100644 --- a/exercises/practice/difference-of-squares/.approaches/intstream/content.md +++ b/exercises/practice/difference-of-squares/.approaches/intstream/content.md @@ -24,12 +24,12 @@ class DifferenceOfSquaresCalculator { This solution iterates using the [`rangeClosed()`][rangeclosed] method of the [`IntStream`][intstream] class. -```exercism/note +~~~~exercism/note The difference between `rangeClosed()` and [`range()`](https://docs.oracle.com/javase/8/docs/api/java/util/stream/IntStream.html#range-int-int-) is that the ending bound is _inclusive_ for `rangeClosed()` and _exclusive_ for `range()`. So, `IntStream.range(1, 10)` iterates from `1` up to but not including `10`, and `IntStream.rangeClosed(1, 10)` iterates from `1` through `10`. -``` +~~~~ In `computeSquareOfSumTo`, the numbers are added with the [`sum()`][sum] method. The sum of the numbers is then multiplied by itself to get the square of the summed numbers. diff --git a/exercises/practice/etl/.docs/instructions.md b/exercises/practice/etl/.docs/instructions.md index 7bb161f8b..802863b54 100644 --- a/exercises/practice/etl/.docs/instructions.md +++ b/exercises/practice/etl/.docs/instructions.md @@ -22,6 +22,6 @@ This needs to be changed to store each individual letter with its score in a one As part of this change, the team has also decided to change the letters to be lower-case rather than upper-case. -```exercism/note +~~~~exercism/note If you want to look at how the data was previously structured and how it needs to change, take a look at the examples in the test suite. -``` +~~~~ diff --git a/exercises/practice/gigasecond/.docs/introduction.md b/exercises/practice/gigasecond/.docs/introduction.md index 74afaa994..18a3dc200 100644 --- a/exercises/practice/gigasecond/.docs/introduction.md +++ b/exercises/practice/gigasecond/.docs/introduction.md @@ -13,7 +13,7 @@ Then we can use metric system prefixes for writing large numbers of seconds in m - Perhaps you and your family would travel to somewhere exotic for two megaseconds (that's two million seconds). - And if you and your spouse were married for _a thousand million_ seconds, you would celebrate your one gigasecond anniversary. -```exercism/note +~~~~exercism/note If we ever colonize Mars or some other planet, measuring time is going to get even messier. If someone says "year" do they mean a year on Earth or a year on Mars? @@ -21,4 +21,4 @@ The idea for this exercise came from the science fiction novel ["A Deepness in t In it the author uses the metric system as the basis for time measurements. [vinge-novel]: https://www.tor.com/2017/08/03/science-fiction-with-something-for-everyone-a-deepness-in-the-sky-by-vernor-vinge/ -``` +~~~~ diff --git a/exercises/practice/isbn-verifier/.approaches/chars-foreach/content.md b/exercises/practice/isbn-verifier/.approaches/chars-foreach/content.md index 0f3963e87..4e7554b05 100644 --- a/exercises/practice/isbn-verifier/.approaches/chars-foreach/content.md +++ b/exercises/practice/isbn-verifier/.approaches/chars-foreach/content.md @@ -51,12 +51,12 @@ If so, it gets the digit value of the codepoint by subtracting the [ASCII][ascii So, if the codepoint is a `0`, then subtracting the ASCII value of `0` from itself results in `0`. If the codepoint is a `1`, then subtracting the ASCII value of `0` from the ASCII value of `1` results in `1`, and so on. -```exercism/note/ +~~~~exercism/note/ Another way to convert the codepoint to a digit is to use the built-in [`Character.digit()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#digit(char,%20int)) method, which also works for [Unicode](https://docs.oracle.com/javase/tutorial/i18n/text/unicode.html) codepoints. Since for this exercise all of the codepoints are ASCII, simple ASCII math will do. -``` +~~~~ The digit is multiplied by 10 minus the position, with the position starting at `0`. So, for the position furthest to the left, the digit is multiplied by `10 - 0` (`10`). diff --git a/exercises/practice/isbn-verifier/.approaches/for-each/content.md b/exercises/practice/isbn-verifier/.approaches/for-each/content.md index 2067405f8..d063b9bc0 100644 --- a/exercises/practice/isbn-verifier/.approaches/for-each/content.md +++ b/exercises/practice/isbn-verifier/.approaches/for-each/content.md @@ -38,12 +38,12 @@ If so, it gets the digit value of the `char` by subtracting the [ASCII][ascii] v So, if the `char` is a `0`, then subtracting the ASCII value of `0` from itself results in `0`. If the `char` is a `1`, then subtracting the ASCII value of `0` from the ASCII value of `1` results in `1`, and so on. -```exercism/note/ +~~~~exercism/note/ Another way to convert the `char` to a digit is to use the built-in [`Character.digit()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#isDigit-char-) method, which also works for [Unicode](https://docs.oracle.com/javase/tutorial/i18n/text/unicode.html) `char`s. Since for this exercise all of the `chars` are ASCII, simple ASCII math will do. -``` +~~~~ The digit is multiplied by 10 minus the position, with the position starting at `0`. So, for the position furthest to the left, the digit is multiplied by `10 - 0` (`10`). diff --git a/exercises/practice/isbn-verifier/.approaches/map-sum/content.md b/exercises/practice/isbn-verifier/.approaches/map-sum/content.md index 0e4d83fc0..6e39ebada 100644 --- a/exercises/practice/isbn-verifier/.approaches/map-sum/content.md +++ b/exercises/practice/isbn-verifier/.approaches/map-sum/content.md @@ -37,12 +37,12 @@ So, if the character is a `0`, then subtracting the ASCII value of `0` from itse If the character is a `1`, then subtracting the ASCII value of `0` from the ASCII value of `1` results in `1`, and so on. -```exercism/note/ +~~~~exercism/note/ Another way to convert the character to a digit is to use the built-in [`Character.digit()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#digit(char,%20int)) method, which also works for [Unicode](https://docs.oracle.com/javase/tutorial/i18n/text/unicode.html) digits. Since for this exercise all of the digits are ASCII, simple ASCII math will do. -``` +~~~~ The digit is multiplied by 10 minus the position, with the position starting at `0`. So, for the position furthest to the left, the digit is multiplied by `10 - 0` (`10`). diff --git a/exercises/practice/isogram/.approaches/filter-map-allmatch/content.md b/exercises/practice/isogram/.approaches/filter-map-allmatch/content.md index 94a5160ab..146302937 100644 --- a/exercises/practice/isogram/.approaches/filter-map-allmatch/content.md +++ b/exercises/practice/isogram/.approaches/filter-map-allmatch/content.md @@ -20,10 +20,10 @@ In the `isIsogram()` method, the [`chars()`][chars] method is called on the inpu Each character is passed as a primitive `int` representing its [Unicode codepoint][char] to the [`filter()`][filter] method. The `filter()` passes each codepoint to the [`IsLetter()`][isletter-codepoint] method to filter in only letter characters. -```exercism/note +~~~~exercism/note Another method that could be used is [`isAlphabetic()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#isAlphabetic-int-). For the difference between `isAlphabetic()` and `isLetter()`, see [here](https://www.baeldung.com/java-character-isletter-isalphabetic). -``` +~~~~ The surviving codepoints are passed to the [`map()`][map] method which converts the codepoints to lower case. diff --git a/exercises/practice/isogram/.approaches/filter-maptoobj-distinct/content.md b/exercises/practice/isogram/.approaches/filter-maptoobj-distinct/content.md index bfa145feb..4a4893170 100644 --- a/exercises/practice/isogram/.approaches/filter-maptoobj-distinct/content.md +++ b/exercises/practice/isogram/.approaches/filter-maptoobj-distinct/content.md @@ -23,10 +23,10 @@ In the `isIsogram()` method, the [`chars()`][chars] method is called on the inpu Each character is passed as a primitive `int` representing its [Unicode codepoint][char] to the [`filter()`][filter] method. The `filter()` passes each codepoint to the [`IsLetter()`][isletter-codepoint] method to filter in only letter characters. -```exercism/note +~~~~exercism/note Another method that could be used is [`isAlphabetic()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#isAlphabetic-int-). For the difference between `isAlphabetic()` and `isLetter()`, see [here](https://www.baeldung.com/java-character-isletter-isalphabetic). -``` +~~~~ The surviving codepoints are passed to the [`mapToObj()`][maptoobj] method which converts each codepoint to a lowercased codepoint. diff --git a/exercises/practice/linked-list/.docs/instructions.md b/exercises/practice/linked-list/.docs/instructions.md index a47942d73..edf4055b3 100644 --- a/exercises/practice/linked-list/.docs/instructions.md +++ b/exercises/practice/linked-list/.docs/instructions.md @@ -13,7 +13,7 @@ Sometimes a station gets closed down, and in that case the station needs to be r The size of a route is measured not by how far the train travels, but by how many stations it stops at. -```exercism/note +~~~~exercism/note The linked list is a fundamental data structure in computer science, often used in the implementation of other data structures. As the name suggests, it is a list of nodes that are linked together. It is a list of "nodes", where each node links to its neighbor or neighbors. @@ -23,4 +23,4 @@ In a **doubly linked list** each node links to both the node that comes before, If you want to dig deeper into linked lists, check out [this article][intro-linked-list] that explains it using nice drawings. [intro-linked-list]: https://medium.com/basecs/whats-a-linked-list-anyway-part-1-d8b7e6508b9d -``` +~~~~ diff --git a/exercises/practice/pangram/.approaches/containsall/content.md b/exercises/practice/pangram/.approaches/containsall/content.md index a1c5b4231..28b0959e1 100644 --- a/exercises/practice/pangram/.approaches/containsall/content.md +++ b/exercises/practice/pangram/.approaches/containsall/content.md @@ -17,12 +17,12 @@ This approach starts by importing from packages for what is needed. The input `String` is lowercased and chained into the [`split()`][split] method to create an array of `String`s. The enclosing [`Arrays.asList()`][aslist] method converts the `String` array into a [`List`][list] of `String`s. -```exercism/note +~~~~exercism/note The `chars()` and `toCharArray()` methods won't work for `Arrays.asList()` because they produce primitive `int`s or `char`s respectively. For `Arrays.asList()` to work as desired, it must take an array of reference types. The `split()` method is used here because it returns an array of `String`s, and `String` is a reference type. -``` +~~~~ The `List` of input character `String`s is chained to the [`containsAll()`][containsall] method. A `String` `List` of the English lowercase letters is passed to `containsAll()`. diff --git a/exercises/practice/pangram/.approaches/filter-distinct-count/content.md b/exercises/practice/pangram/.approaches/filter-distinct-count/content.md index a6c29b3d0..8ee413709 100644 --- a/exercises/practice/pangram/.approaches/filter-distinct-count/content.md +++ b/exercises/practice/pangram/.approaches/filter-distinct-count/content.md @@ -22,10 +22,10 @@ The input `String` is lowercased and chained into the [`chars()`][chars] method. Each character is passed as a primitive `int` representing its [Unicode codepoint][char] to the [`filter()`][filter] method. The `filter()` passes each codepoint to the [`IsLetter()`][isletter-codepoint] method to filter in only letter characters. -```exercism/note +~~~~exercism/note Another method that could be used is [`isAlphabetic()`](https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#isAlphabetic-int-). For the difference between `isAlphabetic()` and `isLetter()`, see [here](https://www.baeldung.com/java-character-isletter-isalphabetic). -``` +~~~~ The the [`count()`][count] of the [`distinct()`][distinct] surviving codepoints are compared with the number of letters expected, which for the English alphabet is `26`. diff --git a/exercises/practice/pangram/.docs/introduction.md b/exercises/practice/pangram/.docs/introduction.md index d38fa341d..32b6f1fc3 100644 --- a/exercises/practice/pangram/.docs/introduction.md +++ b/exercises/practice/pangram/.docs/introduction.md @@ -7,10 +7,10 @@ To give a comprehensive sense of the font, the random sentences should use **all They're running a competition to get suggestions for sentences that they can use. You're in charge of checking the submissions to see if they are valid. -```exercism/note +~~~~exercism/note Pangram comes from Greek, παν γράμμα, pan gramma, which means "every letter". The best known English pangram is: > The quick brown fox jumps over the lazy dog. -``` +~~~~ diff --git a/exercises/practice/pig-latin/.approaches/charat-substring/content.md b/exercises/practice/pig-latin/.approaches/charat-substring/content.md index 2f0634f19..837450067 100644 --- a/exercises/practice/pig-latin/.approaches/charat-substring/content.md +++ b/exercises/practice/pig-latin/.approaches/charat-substring/content.md @@ -75,12 +75,12 @@ Finally, the word is made into Pig Latin by getting a [`substring()`][substring- to which is concatenated a [`substring()`][substring-two] from the beginning of the word up to but not including the indexed character, and concatenating `ay`. -```exercism/note +~~~~exercism/note Note that there are two overloads of the `substring()` method. One takes one argument which will return a substring from the index of the argument until the end of the `String`. The other takes two arguments: the starting index and the ending index. It returns a substring from the starting index up to but not including the ending index. -``` +~~~~ After all of the words are iterated, the `ArrayList` of words is assembled into a single `String` by using the [`String.join()`][join] method to join all of the words together, separated by a single space, diff --git a/exercises/practice/rational-numbers/.docs/instructions.md b/exercises/practice/rational-numbers/.docs/instructions.md index 5de9966ae..f64fc0f28 100644 --- a/exercises/practice/rational-numbers/.docs/instructions.md +++ b/exercises/practice/rational-numbers/.docs/instructions.md @@ -2,11 +2,11 @@ A rational number is defined as the quotient of two integers `a` and `b`, called the numerator and denominator, respectively, where `b != 0`. -```exercism/note +~~~~exercism/note Note that mathematically, the denominator can't be zero. However in many implementations of rational numbers, you will find that the denominator is allowed to be zero with behaviour similar to positive or negative infinity in floating point numbers. In those cases, the denominator and numerator generally still can't both be zero at once. -``` +~~~~ The absolute value `|r|` of the rational number `r = a/b` is equal to `|a|/|b|`. diff --git a/exercises/practice/rna-transcription/.docs/instructions.md b/exercises/practice/rna-transcription/.docs/instructions.md index f787be60b..36da381f5 100644 --- a/exercises/practice/rna-transcription/.docs/instructions.md +++ b/exercises/practice/rna-transcription/.docs/instructions.md @@ -15,6 +15,6 @@ Given a DNA strand, its transcribed RNA strand is formed by replacing each nucle - `T` -> `A` - `A` -> `U` -```exercism/note +~~~~exercism/note If you want to look at how the inputs and outputs are structured, take a look at the examples in the test suite. -``` +~~~~ diff --git a/exercises/practice/rna-transcription/.docs/introduction.md b/exercises/practice/rna-transcription/.docs/introduction.md index d74a8e84d..6b3f44b53 100644 --- a/exercises/practice/rna-transcription/.docs/introduction.md +++ b/exercises/practice/rna-transcription/.docs/introduction.md @@ -4,7 +4,7 @@ You work for a bioengineering company that specializes in developing therapeutic Your team has just been given a new project to develop a targeted therapy for a rare type of cancer. -```exercism/note +~~~~exercism/note It's all very complicated, but the basic idea is that sometimes people's bodies produce too much of a given protein. That can cause all sorts of havoc. @@ -13,4 +13,4 @@ But if you can create a very specific molecule (called a micro-RNA), it can prev This technique is called [RNA Interference][rnai]. [rnai]: https://admin.acceleratingscience.com/ask-a-scientist/what-is-rnai/ -``` +~~~~ diff --git a/exercises/practice/robot-name/.approaches/sequential-take-from-shuffled-names/content.md b/exercises/practice/robot-name/.approaches/sequential-take-from-shuffled-names/content.md index 7024368ac..93f2a09d2 100644 --- a/exercises/practice/robot-name/.approaches/sequential-take-from-shuffled-names/content.md +++ b/exercises/practice/robot-name/.approaches/sequential-take-from-shuffled-names/content.md @@ -52,12 +52,12 @@ to generate the second letter. In another `forEach()`, the second letter is passed in a lambda function that calls [`IntStream.range()`][range] to generate a number from `0` up to but not including `1000`. -```exercism/note +~~~~exercism/note Note that the difference between `IntStream range()` and `IntStream rangeClosed()` is that the upper bound is _exclusive_ for `range()` and is _inclusive_ for `rangeClosed()`. So, `IntStream.range(1, 10)` iterates from `1` up to but not including `10`, and `IntStream.rangeClosed(1, 10)` iterates from `1` through `10`. -``` +~~~~ The number is passed to a lambda which formats the two ASCII values and the number into a string. The `%03d` [format specifier][format-specifiers] indicates having leading zeros for a number up to three places, diff --git a/exercises/practice/scrabble-score/.approaches/if-statements/content.md b/exercises/practice/scrabble-score/.approaches/if-statements/content.md index 69fa03e17..ae274fe8c 100644 --- a/exercises/practice/scrabble-score/.approaches/if-statements/content.md +++ b/exercises/practice/scrabble-score/.approaches/if-statements/content.md @@ -40,10 +40,10 @@ because its value does not need to be changed once it is set. In the constructor, a local variable is defined for being updated in the [`for` loop][for-loop]. -```exercism/note +~~~~exercism/note Using the same for a variable in a nested local scope that is used in its enclosing higher scope is called [variable shadowing](https://www.geeksforgeeks.org/shadowing-in-java/). -``` +~~~~ The variable is updated by a series of `if` statements that checks each letter of the uppercased word. The letter is selected as a `String` by the [`substring()`][substring] method and is passed to the diff --git a/exercises/practice/scrabble-score/.approaches/switch-statement/content.md b/exercises/practice/scrabble-score/.approaches/switch-statement/content.md index 4b91ccf85..30e084a36 100644 --- a/exercises/practice/scrabble-score/.approaches/switch-statement/content.md +++ b/exercises/practice/scrabble-score/.approaches/switch-statement/content.md @@ -50,18 +50,18 @@ because its value does not need to be changed once it is set. In the constructor, a local variable is defined for being updated in the [`for` loop][for-loop]. -```exercism/note +~~~~exercism/note Using the same for a variable in a nested local scope that is used in its enclosing higher scope is called [variable shadowing](https://www.geeksforgeeks.org/shadowing-in-java/). -``` +~~~~ The variable is updated by a [`switch`][switch] statement that checks each letter of the lowercased word. -```exercism/note +~~~~exercism/note If most of the input will already be lower case, it is a bit more performant to normalize the input as lowercased, since fewer characters will need to be changed. However, it may be considered that to use upper case letters is more readable. -``` +~~~~ The letter is selected as a `char` by the [`charAt()`][charat] method and is passed to the `switch`, with each case representing the letters for a particular score. diff --git a/exercises/practice/secret-handshake/.approaches/intstream/content.md b/exercises/practice/secret-handshake/.approaches/intstream/content.md index 8cb004bdb..c54fbf364 100644 --- a/exercises/practice/secret-handshake/.approaches/intstream/content.md +++ b/exercises/practice/secret-handshake/.approaches/intstream/content.md @@ -34,13 +34,13 @@ It does this by use of the [left shift operator][left-shift]. So, if the bit index is `2`, then `1` would be shifted left two places for a binary value of `0100`, which is decimal `4`. It then compares the bitwise value with the `int` argument to the `calculateHandshake()` method by using the [bitwise AND operator][and]. -```exercism/note +~~~~exercism/note Although the argument to `calculateHandshake()` is not directly passed to the lambda, the lambda can use it. To do so is called [capturing](https://www.geeksforgeeks.org/java-lambda-expression-variable-capturing-with-examples/) the variable. To capture a variable, it must be in the enclosing [scope](https://www.geeksforgeeks.org/variable-scope-in-java/) of the lambda, and it must be effectively `final`, meaning that is is not changed in the course of the program. -``` +~~~~ If comparing the bitwise value with the input results in a non-zero bitwise value, then the input contains the value of the bitwise value. diff --git a/exercises/practice/secret-handshake/.docs/instructions.md b/exercises/practice/secret-handshake/.docs/instructions.md index b825c1289..d2120b9bf 100644 --- a/exercises/practice/secret-handshake/.docs/instructions.md +++ b/exercises/practice/secret-handshake/.docs/instructions.md @@ -41,8 +41,8 @@ The secret handshake for 26 is therefore: jump, double blink ``` -```exercism/note +~~~~exercism/note If you aren't sure what binary is or how it works, check out [this binary tutorial][intro-to-binary]. [intro-to-binary]: https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa -``` +~~~~ diff --git a/exercises/practice/sieve/.docs/instructions.md b/exercises/practice/sieve/.docs/instructions.md index ec14620ce..3adf1d551 100644 --- a/exercises/practice/sieve/.docs/instructions.md +++ b/exercises/practice/sieve/.docs/instructions.md @@ -18,11 +18,11 @@ Then you repeat the following steps: You keep repeating these steps until you've gone through every number in your list. At the end, all the unmarked numbers are prime. -```exercism/note +~~~~exercism/note [Wikipedia's Sieve of Eratosthenes article][eratosthenes] has a useful graphic that explains the algorithm. The tests don't check that you've implemented the algorithm, only that you've come up with the correct list of primes. A good first test is to check that you do not use division or remainder operations. [eratosthenes]: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes -``` +~~~~ diff --git a/exercises/practice/simple-linked-list/.docs/instructions.md b/exercises/practice/simple-linked-list/.docs/instructions.md index c3ff4cf31..04640b1fb 100644 --- a/exercises/practice/simple-linked-list/.docs/instructions.md +++ b/exercises/practice/simple-linked-list/.docs/instructions.md @@ -7,7 +7,7 @@ Given a range of numbers (the song IDs), create a singly linked list. Given a singly linked list, you should be able to reverse the list to play the songs in the opposite order. -```exercism/note +~~~~exercism/note The linked list is a fundamental data structure in computer science, often used in the implementation of other data structures. The simplest kind of linked list is a **singly** linked list. @@ -16,4 +16,4 @@ That means that each element (or "node") contains data, along with something tha If you want to dig deeper into linked lists, check out [this article][intro-linked-list] that explains it using nice drawings. [intro-linked-list]: https://medium.com/basecs/whats-a-linked-list-anyway-part-1-d8b7e6508b9d -``` +~~~~