Check Out My YouTube Channel
Algorithm Challenge Available At CodeFights
Given a string, output its longest prefix which contains only digits.
Example
For inputString="123aa1", the output should be longestDigitsPrefix(inputString) = "123".
Hints
- split()
- includes()
- push()
- join()
Input/Output
- [time limit] 4000ms (js)
- [input] string inputString
Guaranteed constraints:
3 ≤ inputString.length ≤ 35.
- [output] string