We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b64ba6 commit 74c59d5Copy full SHA for 74c59d5
String/IsPalindrome.js
@@ -10,7 +10,8 @@
10
* Big-O Analysis
11
* Time Complexity
12
- O(N) on average and worst case scenario as input is traversed in linear fashion
13
- - O(N) on best case scenario, even when input has length of 1, because toString() method takes O(N)
+ - O(1) on best case scenario if the input already is a string (otherwise toString() method takes O(N))
14
+ and the first & last characters don't match, triggering an early return
15
* Space Complexity
16
- O(1)
17
*/
0 commit comments