Python / Data Structures

Creating a dictionary from a list of integers
AskAI

Given a list of integers, this function will return a dictionary with the integers as keys and the number of times the integer appears in the list as values.

Finding the Longest Increasing Subsequence in an Array
AskAI

The problem is to find the length of the longest increasing subsequence in an array. For example, given the array [10, 22, 9, 33, 21, 50, 41, 60, 80], the longest increasing subsequence would be of length 6, and would be [10, 22, 33, 50, 60, 80].

Sum of integers divisible by 3 in a list
AskAI

The function should take a list of integers as input and return the sum of the integers in the list that are divisible by 3.

Sum of elements in a list of integers
AskAI

This technical problem deals with finding the sum of all the elements in a list of integers. An example input would be [1, 2, 3, 4, 5], and the corresponding output would be 15.

Find the indices of two numbers that add up to the target value in a list of...
AskAI

The problem is to find the indices of two numbers in a list of integers that add up to a given target value. An example input would be [2, 7, 11, 15] with a target value of 9, and the expected output would be [0, 1].

Find the sum of the integers at even indices in a list.
AskAI

Given a list of integers, this program will find the sum of the integers at even indices. So, for the example input above, the output would be 12 (2 + 4 + 6 ).

Counting Elements in a List
AskAI

The technical problem is to write a Python script to return a dictionary containing the count of each unique integer in a given list. For example, given the list [1, 2, 1, 2, 1, 3, 3, 3, 4, 4, 4, 4], the expected output would be {1: 3, 2: 2, 3: 3, 4: 4}.

Counting the Occurrences of Integers in a List
AskAI

This problem asks you to write a function that takes a list of integers and returns a dictionary with the integers as keys and the number of times they appear in the list as values.