Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

Evaluate "2 3 # 4 #" where the binary operator # on operands a and b (in postfix order) returns a * b + 1.

  1. A. 29
  2. B. 30
  3. C. 28
  4. D. 25

Correct answer: A. 29

Apply # to 2 and 3 to get 7, then apply it to 7 and 4 to get 29. Evaluating the operands in the wrong order gives a different value.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic