Skip to content

Commit 65e9601

Browse files
committed
Runtime: 35 ms (Top 95.05%) | Memory: 21.1 MB (Top 38.81%)
1 parent 2677361 commit 65e9601

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 35 ms (Top 95.05%) | Memory: 21.1 MB (Top 38.81%)
12
class CustomStack {
23
int *data;
34
int nextIndex;
@@ -8,15 +9,15 @@ class CustomStack {
89
nextIndex = 0;
910
capacity = maxSize;
1011
}
11-
12+
1213
void push(int x) {
1314
if(nextIndex == capacity){
1415
return;
1516
}
1617
data[nextIndex] = x;
1718
nextIndex++;
1819
}
19-
20+
2021
int pop() {
2122
if(nextIndex == 0){
2223
return -1;
@@ -25,12 +26,12 @@ class CustomStack {
2526
nextIndex--;
2627
return temp;
2728
}
28-
29+
2930
void increment(int k, int val) {
30-
//loop will run upto nextIndex if k >= nextIndex else runt upto k only
31+
//loop will run upto nextIndex if k >= nextIndex else runt upto k only
3132
int n = (k >= nextIndex) ? nextIndex : k;
3233
for(int i = 0; i < n; i++){
33-
data[i] = data[i] + val;
34+
data[i] = data[i] + val;
3435
}
3536
}
36-
};
37+
};

0 commit comments

Comments
 (0)