Stacks And Queues

Determining Validity of Strings with Brackets
AskAI

This technical problem deals with determining whether or not a given string consisting of only brackets is valid. A string is considered valid if the open brackets are closed by the same type of brackets in the correct order. An empty string is also considered valid.

Find the Largest Integer in a List
AskAI

Given a list of integers, this code problem finds the largest integer in the list. For example, given the input [1, 2, 3, 4, 5], the output would be 5.

Reverse the Order of Words in a String
AskAI

Given a string, reverse the order of the words. Do not use any built-in reverse functions.

Printing the median of a stream of integers.
AskAI

This problem deals with printing the median of a stream of integers. At each time step, the median of the integers received so far is printed out.

Sum of integers at even indices
AskAI

This problem asks you to write a function that takes in a list of integers and returns the sum of the integers at even indices. For example, given the input list [1, 2, 3, 4, 5], the function should return 6 (2 + 4).

Implement a queue using two stacks
AskAI

Implement a queue using two stacks. This means that when you enqueue an item, it goes onto one of the stacks, and when you dequeue an item, it comes off of the other stack.

Check if a string of parentheses is balanced.
AskAI

Given a string of parentheses, this function determines whether the string is balanced. A string is balanced if each opening parentheses is matched by a closing parentheses. For example, the input "(())" would return True, while the input "())(" would return False.

Sum of integers in a stack
AskAI

The problem is to find the sum of all the integers in a stack. An example input is given, as well as the expected output.