Code Problem

Find the first non-repeating character in a string.
AskAI

Given a string, this problem returns the index of the first non-repeating character in the string. If there is no such character, the problem returns -1.

Find the maximum average value in a given array of integers.
AskAI

Given an array of n integers, this algorithm finds the contiguous subarray of given length k that has the maximum average value. The output is the maximum average value.

Maximum Subarray Sum
AskAI

Given an array of integers, this algorithm finds the maximum sum of any contiguous subarray of the array. For example, given the input array [34, -50, 42, 14, -5, 86], the algorithm would output 137.

Sum of Odd Numbers in Array
AskAI

Given an array of integers, the function returns the sum of the odd numbers in the array.

Array Sum
AskAI

This problem involves finding the sum of all elements in an array. For example, given the array [1, 2, 3, 4, 5], the sum would be 15.

Is One String a Permutation of the Other?
AskAI

This problem asks whether one string is a permutation of another. To check this, we can compare the two strings character by character. If they have the same characters in the same order, then one is a permutation of the other.

Array Sum
AskAI

The problem asks for the sum of the first n numbers in an array.

Odd Number Sum in Array
AskAI

The function should take an array of integers as input and return the sum of the odd numbers in the array.