Skip to content

Latest commit

 

History

History

firstDigit

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Check Out My YouTube Channel

Algorithm Challenge Available At CodeFights

Find the leftmost digit that occurs in a given string.

Example

  • For inputString = "var_1__Int", the output should be firstDigit(inputString) = '1';

  • For inputString = "q2q-q", the output should be firstDigit(inputString) = '2';

  • For inputString = "0ss", the output should be firstDigit(inputString) = '0'.

Hints

  • split()
  • includes()

Input/Output

  • [execution time limit] 5 seconds (ts)

  • [input] string inputString

A string containing at least one digit.

Guaranteed constraints:

3 ≤ inputString.length ≤ 10.

  • [output] char