Time Complexity

Maximizing Area in a Bar Graph

Given an array of n integers, where each integer represents the height of a bar in a bar graph, write a function that returns the maximum area that can be formed by choosing two bars from the array and stacking them on top of each other.

275
Dec 13
Find the Maximum Average Value in an Array

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.

222
Dec 11
Longest Increasing Subsequence in an Array

Given an array of integers, find the length of the longest increasing subsequence.

226
Dec 11
Longest Increasing Subsequence

Given an array of integers, this problem seeks to find the length of the longest increasing subsequence within that array. For example, given the input array [10, 9, 2, 5 , 3, 7, 101, 18], the longest increasing subsequence would be of length 4.

211
Dec 10
Find the Maximum Sum of a Contiguous Subarray

Given an array of n integers, this algorithm will find the maximum sum of any contiguous subarray of the array. For example, given the input array [1, -3, 2, 1, -1], the algorithm would output 3.

220
Dec 09
First non-repeating character in a string.

Given a string, find the first non-repeating character. For example, in the string "abacabad", the first non-repeating character is 'c'.

222
Dec 08
Sum all elements in a list

To sum all elements in a list, we can simply iterate through the list and add each element to a running total. This will take O(n) time, where n is the length of the list.

157
Dec 06
Longest Increasing Subsequence in an Array

Given an array of integers, this problem seeks to find the length of the longest increasing subsequence within that array. For example, given the input array [10, 9, 2, 5 , 3, 7, 101, 18], the longest increasing subsequence would be of length 4.

175
Dec 05