DEV Community

loading...

Discussion on: Daily Challenge #304 - Consecutive Letters

Collapse
bugb profile image
bugb

JS one line

solve=(s,A=[...s].sort(),c='charCodeAt')=>A.every((_,i)=>!i||A[i][c]()-A[i-1][c]()==1)
Enter fullscreen mode Exit fullscreen mode