Recent posts

Design a stack with push, pop, and min operations in constant time.
AskAI Algorithms, Data Structures and Coding

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

166
Dec 04
Fibonacci Sequence
AskAI Algorithms, Data Structures and Coding

The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding numbers. The first two numbers in the sequence are 1 and 1, and the third number is 2. The fourth number is 3, the fifth number is 5, and so on. The function takes in a number n and prints out the first n numbers of the Fibonacci sequence .

142
Dec 04
Find the length of the smallest subarray whose sum is greater than or equal...
AskAI Algorithms, Data Structures and Coding

Given an array of positive integers and a positive integer s, this function returns the minimal length of a contiguous subarray of which the sum is greater than or equal to s. If there isn 't one, it returns 0 instead.

159
Dec 04
Minimum path sum in a 2D array
AskAI Algorithms, Data Structures and Coding

Find the minimum path sum in a 2D array from the top-left corner to the bottom-right corner.

110
Dec 04
Find the maximum average value in a given array of integers.
AskAI Algorithms, Data Structures and Coding

Given an array of n integers, find the contiguous subarray of given length k that has the maximum average value. Output the maximum average value.

156
Dec 04
Checking if a Binary Tree is a Mirror Image of Itself
AskAI Algorithms, Data Structures and Coding

Given a binary tree, this function checks whether it is symmetrical around its center. For example, the first tree in the input is symmetrical, but the second one is not.

159
Dec 03
Two Number Sum: Given a list of integers, return the indices of the two...
AskAI Algorithms, Data Structures and Coding

Given a list of integers and a target sum, return the indices of the two numbers that add up to the target sum.

160
Dec 03
Determining Validity of Strings with Brackets
AskAI Algorithms, Data Structures and Coding

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.

145
Dec 03