Strings

Find the Maximum Average Value in an Array
AskAI

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.

Find the Median of an Array
AskAI

Given an array of numbers, find the median (middle) value.

Maximum Subarray Sum
AskAI

Given an array of n integers, this problem looks for the maximum sum of any contiguous subarray within the array.

Non-repeating characters in a string.
AskAI

The problem is to find the first non-repeating character in a given string. The function should take a string as input and return the first non-repeating character.

Is the String a Palindrome?
AskAI

This problem asks whether a given string is a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. In this case, the input string " racecar" is a palindrome, so the output would be "true".

Longest Common Prefix in an Array of Strings
AskAI

Given an array of strings, this problem seeks to find the longest common prefix. This can be done by comparing the first string in the array with the second string, then the second string with the third string, and so on. The longest common prefix is the substring that is shared by all strings in the array.

Find the length of the longest substring without repeating characters.
AskAI

This problem asks you to find the length of the longest substring in a given string without any repeating characters. Examples are provided to illustrate how this would work. Note that the answer must be a substring, not just a subsequence.

Unique Characters in a String
AskAI

This problem asks you to implement an algorithm to determine if a string has all unique characters. This can be done by keeping track of which characters have been seen so far in a hash set, and then checking if the character being processed is already in the set. If it is, then we know that the string does not have all unique characters.