Back to problems

String to Integer (atoi) (Digits Only)

Algorithm · Bloomberg · Easy

Problem Create a function that turns a string containing a number into its integer value. Input: a string s made up exclusively of the digit characters 0 through 9 Output: the equivalent integer in decimal notation In this task, signs, surrounding spaces, and integer-range limits do not matter; s will always represent a valid non-negative integer. Constraints 1 <= len(s) <= 1e5 Examples Input: "407" Output: 407 Explanation: The digits describe the decimal value 407. Input:…

Checking your access…