Question d’entretien chez CloudEndure

parse number from string without using the language parsing technologies

Réponses aux questions d'entretien

Utilisateur anonyme

28 juill. 2019

The main idea is to parse each digit of the string (starting from the least significant one) to a number, multiply the result by ten and add the digit. If the char is not a digit return or throw an error;

Utilisateur anonyme

31 juill. 2020

1. After checking for null or blank string, 2. initialize a "sum" variable to 0 3. ...and iterate over all digits from right to left - with each iteration add str[i] * 10^i to sum. 4. done