Indeed, some of my early answers to this problem used String.fromCharCode(97 + k % 25), but I found that defining the alphabet was actually more performant, at least using leetcode's timers.
Up until recently, I've been posting these solutions only on leetcode's forums, so my goal was to find the absolute most performant method given their testing methods. But since I've recently started aggregating my past solutions here, I've stripped out the references to leetcode times and plan from here on out to focus a bit more on strictly O(n) efficiency and readability and less on leetcode's often-capricious timers.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the input!
Indeed, some of my early answers to this problem used
String.fromCharCode(97 + k % 25)
, but I found that defining the alphabet was actually more performant, at least using leetcode's timers.Up until recently, I've been posting these solutions only on leetcode's forums, so my goal was to find the absolute most performant method given their testing methods. But since I've recently started aggregating my past solutions here, I've stripped out the references to leetcode times and plan from here on out to focus a bit more on strictly O(n) efficiency and readability and less on leetcode's often-capricious timers.