wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

A function f defined on stacks of integers satisfies the following properties. f(ϕ)=0 and f (push(S)) = max (f(S), 0) + i for all stack S and integers. If a stack S contains the integers 2, -3, 2, -1, 2 in order from bottom to top. What is f(S)?

A
2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
4
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
3
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
6
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Join BYJU'S Learning Program
CrossIcon