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.
- A. 29
- B. 30
- C. 28
- 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.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the minimum number of operations needed to reduce 191 to 0, where each operation subtracts any single power of two that is at most…
- What is the sum of all integers from 1 to 100 inclusive that are divisible by neither 3 nor 7?
- How many windows of length 3 in [1, 2, 1, 2, 3, 3, 1] contain exactly two distinct values?
- What is the floor of the square root of the sum of [1000, 2500, 900]?
- How many indices i in "xyzxyzxyz" satisfy s[i] = s[i + 3]?
- A singly linked list holds 1..7. Using the slow/fast pointer method, the slow pointer reaches the middle node. How many nodes come after…