Move all zeros present in the array to the end

Given an array of integers, move all zeros present in the array to the end. The solution should maintain the relative order of items in the array. Return the modified array. Example Solution Let ar ...
Murat Sütunç
Published on Nov 16th, 2017

Find Equilibrium Index of an Array

Equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For example, in an array A: (A[0] + A[1] + ... + A[i-1]) = ...
Murat Sütunç
Published on Nov 16th, 2017

Rearrange the array with alternate high and low elements

Given an array of integers, rearrange the array such that every second element of the array is greater than its left and right elements. Assume no duplicate elements are present in the array. Exampl ...
Murat Sütunç
Published on Nov 16th, 2017

Find index of 0 to be replaced to get maximum length sequence of continuous ones

Given a binary array, find the index of 0 to be replaced with 1 to get the maximum length sequence of continuous 1s. Return that index. Example Solution Let array arr equal to [ 0, 0, 1, 0, 1, 1, 1 ...
Murat Sütunç
Published on Nov 16th, 2017

Merge two arrays by satisfying given constraints

Given two sorted integer arrays arr1 and arr2 where length of arr1 is equal or larger than length of arr2. The array arr1 has exactly x vacant cells, which is equal to the difference in length betwee ...
Murat Sütunç
Published on Nov 16th, 2017

Find maximum length sub-array having given sum

Given an array of integers, find the maximum length of the sub-array having the given sum. Example Solution Let array arr equal to [ 5, 6, -5, 5, 3, 5, 3, -2, 0 ] and integer sum equal to 8. Sub-a ...
Murat Sütunç
Published on Nov 16th, 2017

Find a duplicate element in a limited range array

Given a limited range array of size n where array contains elements between 1 to n - 1 with one element repeating, find the duplicate number in this array. Example Solution Let array arr equal to [ ...
Murat Sütunç
Published on Nov 16th, 2017

Check if subarray with 0 sum is exists or not

Given an array of integers, check if the array contains a sub-array such that, when you add all the array members the summation is equal to zero. Example Solution Let array arr equal to [ 3, 4, -7, ...
Murat Sütunç
Published on Nov 16th, 2017

Parentheses in Codeland

John is a student at Codeland Primary School and he is in trouble with his homework and he needs your help. He tries to check validation of given parentheses. There are three types of opening and clo ...
Coder
Published on Nov 1st, 2017

Highest Profit

John is a clever salesman at Codeland and he fell into a debt stake and for this reason, he deciced to sell out secondhand cars but he needs your help to get highest profit. You are given an integer ...
Murat Sütunç
Published on Nov 1st, 2017