# Category Archives: Arrays

## Minimum sum of product of two arraysNovember 8, 2017

Find the minimum sum of Products of two arrays of the same size, given that k modifications are allowed on the first array. In each… Read More »

## Set update() in Python to do union of n arrays

We are given n arrays of any size which may have common elements, we need to combine all these arrays in such a way that… Read More »

## Longest subarray not having more then K distinct elements

Given N elements and a number K, find the longest subarray which has not more then K distinct elements.(It can have less then K) Examples:… Read More »

## Elements to be added so that all elements of a range are present in arrayNovember 7, 2017

Given an array of size N. Let A and B be the minimum and maximum in the array respectively. Task is to find how many… Read More »

## Longest subsequence with no 0 after 1

Given a binary array, find length of the longest subsequence such that there is no 0 after a 1. Examples: Input : 1 1 0… Read More »

## intersection_update() in Python to find common elements in n arraysNovember 6, 2017

We are given list of n number of arrays, find all common elements in given arrays ? Examples: Input : arr = [[1,2,3,4], [8,7,3,2], [9,2,6,3],… Read More »

## Number of cyclic elements in an array where we can jump according to valueNovember 5, 2017

Given a array arr[] of n integers. For every value arr[i], we can move to arr[i] + 1 clockwise considering array elements in cycle. We… Read More »

## Smallest subarray with k distinct numbers

We are given an array a consisting of n integers and an integer k. We need to find minimum range in array [l, r] (both… Read More »

## Number of steps to convert to prime factors

Given an array arr[] of n positive integers. Represent every number as its factors (x * y = arr[i]) [Here x or y cannot be… Read More »

## Powers of two and subsequencesNovember 3, 2017

Given an array of size N, find count of subsequences which when multiplied result in a number which is a power of 2. Examples: Input… Read More »

## Subsequences of size three in an array whose sum is divisible by m

Given an array A[] (1

## Move all zeroes to end of array using List Comprehension in PythonNovember 2, 2017

Given an array of random numbers, Push all the zeros of a given array to the end of the array. For example, if the given… Read More »

## Sum of array elements after every element x is XORed itself x times

Given an array of integers, the task is to compute sum of all array element after doing XOR of each element x with itself x… Read More »

## Find four missing numbers in an array containing elements from 1 to NNovember 1, 2017

Given an array of unique integers where each integer of the given array lies in the range [1, N]. The size of array is (N-4).… Read More »

## Merge two sorted arrays in Python using heapq

Given two sorted arrays, the task is to merge them in a sorted manner. Examples: Input : arr1 = [1, 3, 4, 5] arr2 =… Read More »