From 663f050ee7c46cc18afb557969afa8faea4785f8 Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:28:31 +0530 Subject: [PATCH] Create 1381. Design a Stack With Increment --- 1381. Design a Stack With Increment | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 1381. Design a Stack With Increment diff --git a/1381. Design a Stack With Increment b/1381. Design a Stack With Increment new file mode 100644 index 0000000..adcc90d --- /dev/null +++ b/1381. Design a Stack With Increment @@ -0,0 +1,37 @@ +class CustomStack { +public: + int k; + vector v; + CustomStack(int maxSize) { + k = maxSize; + } + + void push(int x) { + if(v.size()0){ + int x = v[v.size()-1]; + v.pop_back(); + return x; + } + else return -1; + } + + void increment(int t, int val) { + for(int i=0; ipush(x); + * int param_2 = obj->pop(); + * obj->increment(k,val); + */