Stacks And Queues

Reverse a String Using a Stack
AskAI

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

Reversing a String Using a Stack
AskAI

This problem asks you to reverse a string using a stack. An example input would be "abc" and the corresponding output would be "cba".

Find the Largest Rectangle in a List of Buildings
AskAI

Given a list of integers, where each element represents the height of a building, find the largest rectangle that can be formed from a subset of the buildings in the list. The largest rectangle is defined as the area formed by the buildings with the largest height.

Determining if a string is balanced
AskAI

This problem is about determining if a string is balanced, meaning that every open parenthesis has a corresponding close parenthesis, and vice versa. An example of an input string that would return " true" is "(()())". An example of an input string that would return "false" is "())(".

Implement a stack with a max function
AskAI

Implement a stack with a max function that returns the maximum value in the stack.

Odd Index Sum
AskAI

Given a list of integers, this function will return the sum of the integers at the odd indices. For example, given the input list [1, 2, 3, 4, 5], the function will return 9.

"Balanced Parentheses"
AskAI

The problem is to write a function that takes a string of parentheses and returns true if the parentheses are balanced, and false if they are not.

Sort a stack of integers in ascending order.
AskAI

Given a stack of integers, this algorithm will sort the stack in ascending order. Additional stacks may be used to hold the elements, but no other data structures are allowed.