Google Phone Screen
Anonymous User
2565

given a string with combination of operators & operands. The numbers are floating point integers. Process the string to find the final result.
Operators will be fixed length corresponding to their usual meaning ie add, mul, sub, pow, div
see examples below

  • add(1,2)
  • mul(2e3, sub(4,2))
  • add(2.4, pow(2,4e4.5))

overflows & division by 0 will not be there.

Hint for c++ users use strtod()

Comments (8)