Stacks And Queues

Validity of a String
AskAI

This function checks whether a given string containing only '(', ')' and '*' characters is valid. A string is considered valid if it follows the rules defined above.

Stack sum function
AskAI

Given a stack of integers, the function returns the sum of the elements in the stack.

Check if a string of parentheses is balanced.
AskAI

This function takes in a string consisting only of parentheses and outputs whether or not the string is balanced. A string is balanced if every open parenthesis has a corresponding close parenthesis and there are no unmatched parentheses.

Return the sum of integers at even indices
AskAI

This problem asks the programmer to return the sum of all integers at even indices in a given list. For example, given the list [1, 2, 3, 4, 5], the output would be 6 (2 + 4).

Evaluating a Simple Expression String
AskAI

Given a simple expression string consisting of parentheses, plus/minus signs, and non-negative integers, implement a basic calculator to evaluate the string.

Stack Order Checker
AskAI

The function should return true if the stack is in sorted order (increasing order), and false otherwise.

Reverse a string using a stack
AskAI

This problem asks you to reverse a string using a stack. An example input and output is provided.

Design a stack with push, pop, and min operations in constant time.
AskAI

A stack is a data structure that supports push, pop, and min operations in constant time.