lshimokawa / prefix_notation

Coding exercise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Write a program to evaluate a prefix notation string. Input operators + * - /. Numbers are all positive integers only.

Example:

  • "9" => 9
  • "+ 1 2" => 3 (1 + 2)
  • "+ + 1 2 30" => 33 ((1+2)+30)
  • "+ + 12 16 * 10 4" => 68 ((12+16)+(10*4))

About

Coding exercise


Languages

Language:Ruby 100.0%