Skip to content

Commit 6d2b21a

Browse files
committed
Reverse String: Add emoji bonus to description
I've added an emoji bonus to the description of reverse string. This introduces Unicode. Knowing that there are different ways to encode text, and that not all characters are the same size is important. I've made it a bonus because it's not straight forward in every language.
1 parent 901b11d commit 6d2b21a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

exercises/reverse-string/description.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,27 @@ Reverse a string
33
For example:
44
input: "cool"
55
output: "looc"
6+
7+
## For bonus points
8+
9+
Did you get the tests passing and the code clean? If you want to, these
10+
are some additional things you could try:
11+
12+
- ASCII, UTF-8 and UTF-16 are 3 common character encodings you are likely to
13+
encounter as a programmer. ASCII is a character encoding published in 1963
14+
designed for representing English language text. UTF-8 and UTF-16 are both
15+
Unicode character encodings. Unicode was first published in 1991 and can now
16+
represent English language text, foreign text, historic text and emojis.
17+
18+
UTF-8 and UTF-16 both represent English language characters as a single code
19+
unit. But many emoji characters require 2 or more code units.
20+
21+
Add a test for reversing a string of a couple emoji characters. You may find
22+
that your existing solution has been reversing bytes or code units instead of
23+
characters.
24+
25+
Here is an example emoji string: 😀☕
26+
And its reverse: ☕😀
27+
28+
Note that some languages are not Unicode aware. It is not recommended to try
29+
this challenge if your language does not have good Unicode support.

0 commit comments

Comments
 (0)