# Tag Archives: array-traversal-question

## Find index after traversing a permutation Array of 1 to N by K steps

Given an integer K and an index array arr[] of length N which contains elements in the range [1, N], the task is to find… Read More »

## Minimum Group Flips to Make Binary Array Elements Same

Given a binary array, we need to convert this array into an array that either contains all 1s or all 0s.  We need to do… Read More »

## Sum of non-diagonal parts of a square Matrix

Given a square matrix of size N X N, the task is to find the sum of all elements at each portion when the matrix… Read More »

## Python | Number of elements to be removed such that product of adjacent elements is always even

Given an array of N integers. The task is to eliminate the number of elements such that in the resulting array the product of any… Read More »

## Move all zeros to start and ones to end in an Array of random integers

Given an array arr[] of random integers, the task is to push all the zero’s in the array to the start and all the one’s… Read More »

## Replace array elements by sum of next two consecutive elements

Given an array arr[] of size n, The task is to replace every element of the array by the sum of next two consecutive elements… Read More »

## Maximum number of continuous Automorphic numbers

Given an array of N elements. The task is to find the maximum number of the contiguous automorphic numbers in the given array. Automorphic Numbers:… Read More »

## Character whose frequency is equal to the sum of frequencies of other characters of the given string

Given a string str consisting of lowercase English alphabets. The task is to find whether there is any character in the string whose frequency is… Read More »

## Find the first maximum length even word from a string

Given a string of words separated by spaces. The task is to find the first maximum length even word from the string. Eg: “You are… Read More »

## Print direction of moves such that you stay within the [-k, +k] boundary

Given an array arr[] of N positive integers and an integer K. It is given that you start at position 0 and you can move… Read More »

## Minimize sum of adjacent difference with removal of one element from array

Given an array of positive integers of size greater than 2. The task is to find the minimum value of sum of consecutive difference modulus… Read More »

## Group consecutive characters of same type in a string

Given a string str consisting of upper case alphabets, numeric digits and arithmetic operators, the task is to group them into continuous sub-strings of same… Read More »

## Pick maximum sum M elements such that contiguous repetitions do not exceed K

Given an array arr[] of distinct elements and two integers M and K, the task is to generate an array from the given array elements… Read More »

## Minimum cost to make two strings same

Given four integers a, b, c, d and two strings S1 and S2 of equal length, which consist only of the characters ‘2’, ‘1’ and… Read More »

## Maximum occurrence of prefix in the Array

Given a string consisting of lower case English Alphabets. The task is to count the number of occurrences of the non-empty prefix which occurs the… Read More »