Skip to content

Commit c57a755

Browse files
committed
doc: add info
1 parent f19bb78 commit c57a755

File tree

1 file changed

+46
-12
lines changed
  • src/interview-classics/is-palindrome

1 file changed

+46
-12
lines changed
+46-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,48 @@
11
# Is Palindrome
22

3-
Create a function named isPalindrome that takes a string as an input, outputs
4-
true if the string is a palindrome, or false otherwise.
5-
6-
Ignore the following characters
7-
8-
- Whitespace
9-
- .
10-
- ,
11-
- :
12-
- ;
13-
- ?
14-
- !
3+
Write a function `isPalindrome` that takes a string as input, and returns
4+
whether the string is a palindrome.
5+
6+
Punctuation is ignored when validating a palindrome. You only need to consider
7+
the following punctuation characters:
8+
9+
```
10+
- . , : ; ? ! ' "
11+
```
12+
13+
White space is also ignored when validating a palindrome. You only need to
14+
consider the followihg whitespace characters for this exercise
15+
16+
* `space`
17+
* `tab`
18+
* `new line`
19+
20+
## Function Signagure
21+
22+
```typescript
23+
function isPalindrome(str: string): boolean
24+
```
25+
26+
## Expected Behavior
27+
28+
```
29+
In: ''
30+
Out: true
31+
32+
In: 'x'
33+
Out: true
34+
35+
In: 'xy'
36+
Out: false
37+
38+
In: '1230321'
39+
Out: true
40+
41+
In: '1230123'
42+
Out: false
43+
44+
In: ' a: \nbc. c!-ba? "'
45+
Out: true
46+
```
47+
48+
## Optimizations

0 commit comments

Comments
 (0)