This example will show you how to segregate positive followed by negative elements in an Array using Java programming language. The function will put all positive numbers first, and then negative numbers and finally count the number of moves required to arrange all elements in the desired order. Prerequisite Knowledge of Java Let’s move on […]

## Minimum Moves to Equalize Array Elements

Here we will find out minimum moves to equalize array elements. We will check the equality of elements from two arrays. As a pre-condition both arrays must have equal number of elements, i.e., in other words both arrays must be of same length. We will read each element from both arrays one by one at […]

## Minimum moves to segregate even followed by odd elements in Array

This tutorial will find out minimum moves to segregate even followed by odd elements in Array using Java programming language. The function will put all even numbers first, and then odd numbers and finally count the number of moves required to arrange all elements in the desired order.

## Return array of products of all other numbers from a given array

This tutorial will show you how to return array of products of all other numbers from a given array. Let’s say you are given an array of non-zero integers. So you have to return an output array of products of all other numbers except the number itself.

## Finding Start and End Index of an element in a sorted Array using Kotlin

Finding start and end index of an element in a sorted array using Kotlin programming language will be shown here. The array may contain duplicate elements and we will see how to find a start and end index for an element in this array elements. We may design the algorithm for finding start and end […]

## Hackerrank Solution: 1D Array – Part 2 using Kotlin

This tutorial will show you Hackerrank 1D Array Part 2 using Kotlin. Let’s play a game on an array! You’re standing at index 0 of an n-element array named game. From some index i (where 0 <= i < n), you can perform one of the following moves: Move Backward: If cell i-1 exists and […]

## HackerRank Solution: Subarray using Kotlin

This tutorial will show you how to solve HackerRank Subarray using Kotlin. A subarray of an n-element array is an array composed from a contiguous block of the original array’s elements. For example, if array=[1,2,3], then the subarrays are [1], [2], [3], [1,2], [2,3], and [1,2,3]. Something like [1,3] would not be a subarray as […]

## Move Non-Zero Array Elements to Left using Java

This examples shows how to move all non-zero elements(if any) in an array to the left and all zero elements to the right in the array using Java.