## Stacks And Queues

##### Is This String Valid?

The function takes a string containing only three types of characters - '(', ')' and '*' - and returns whether the string is valid according to the following rules: 1. Any left parenthesis '(' must have a corresponding right parenthesis ')'. 2. Any right parenthesis ')' must have a corresponding left parenthesis '('. 3. Left parenthesis '(' must go before the corresponding right parenthesis ')'. 4. '*' could be treated as a single right parenthesis ')' or a single left parenthesis '(' or an empty string. 5. An empty string is also valid.

221
Nov 05
##### Check if a string of parentheses is balanced

Given a string of parentheses, this algorithm determines whether the string is balanced. A string is balanced if it contains as many opening parentheses as it does closing parentheses, and if each opening parenthesis is matched with a closing parenthesis that appears after it in the string.

168
Nov 05
##### Implementing a Queue Using Two Stacks

A queue can be implemented using two stacks. In this implementation, one stack is used for enqueueing items, and the other stack is used for dequeueing items. When an item is enqueued, it is pushed onto the enqueue stack. When an item is dequeued, it is popped from the dequeue stack. If the dequeue stack is empty, then the items in the enqueue stack are popped and pushed onto the dequeue stack.

225
Nov 03
##### Checking for Balanced Parentheses

This function takes in a string of parentheses and determines if it is balanced. A string is balanced if each opening parentheses has a corresponding closing parentheses and the order of the parentheses is maintained.

211
Nov 03
##### Find the median of a stream of integers

To find the median of a stream of integers, we can use a min heap and a max heap. We can keep track of the median by comparing the top elements of the heaps. If they are equal, then the median is the average of those two numbers. If the max heap has more elements, then the median is the top element of the max heap. Otherwise, the median is the top element of the min heap.

205
Nov 03
##### Implement a queue using two stacks

Implement a queue using two stacks.

214
Oct 31
##### "Sum of Integers at Odd Indices"

Write a function that takes in a list of integers and returns the sum of the integers at odd indices.

197
Oct 24
##### Largest Integer in a List

This problem asks you to write a function that returns the largest integer in a given list. For example, if the input list is [1, 2, 3, 4, 5], the largest integer in the list is 5.

217
Oct 23