We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Data Structures
- Stacks
- Maximum Element
- Discussions
Maximum Element
Maximum Element
Sort by
recency
|
1477 Discussions
|
Please Login in order to post a comment
En Python
def getMax(operations): s = [] p = [] for i in range(n): s.append(str(ops[i]).split(' ')) if s[i][0] == '1': p.append(int(s[i][1])) if s[i][0] == '2': p.pop() if s[i][0] == '3': print(max(p))
My C code int* getMax(int operations_count, char** operations, int* result_count) { int* stack = malloc(operations_count * sizeof(int)); int stack_size = 0; int* result = malloc(operations_count * sizeof(int)); *result_count = 0;
}
Python