Skip to content

Commit 6c2f275

Browse files
eliaahadiErikSchierboom
authored andcommitted
reverse-string: Add new exercise (#960)
* reverse string * updates per #960 * delete DS store * updated test cases mostly * added edits to test cases * updates JSON and description files * updated comments * rename json and comment edits * updated comments * rename property to reverse * simpler description * update metadata * no adds to .gitignore * simpler description * description & can data edits * no gitignore or .DS_store * case description updates * Restore .gitignore * edit to palindrome description
1 parent 5470fef commit 6c2f275

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"exercise": "reverse-string",
3+
"version": "1.0.0",
4+
"comments": [
5+
"If property based testing tools are available, a good property to test is reversing a string twice: reverse(reverse(string)) == string"
6+
],
7+
"cases": [
8+
{
9+
"description": "empty string",
10+
"property": "reverse",
11+
"input": "",
12+
"expected": ""
13+
},
14+
{
15+
"description": "a word",
16+
"property": "reverse",
17+
"input": "robot",
18+
"expected": "tobor"
19+
},
20+
{
21+
"description": "a capitalized word",
22+
"property": "reverse",
23+
"input": "Ramen",
24+
"expected": "nemaR"
25+
},
26+
{
27+
"description": "a sentence with punctuation",
28+
"property": "reverse",
29+
"input": "I'm hungry!",
30+
"expected": "!yrgnuh m'I"
31+
},
32+
{
33+
"description": "a palindrome",
34+
"property": "reverse",
35+
"input": "racecar",
36+
"expected": "racecar"
37+
}
38+
]
39+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Reverse a string
2+
3+
For example:
4+
input: "cool"
5+
output: "looc"

exercises/reverse-string/metadata.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
blurb: "Reverse a string"
3+
title: "reverse-string"
4+
source: "Introductory challenge to reverse an input string"
5+
source_url: "https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb"

0 commit comments

Comments
 (0)