Array

Segregate positive followed by negative elements in an Array

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 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.

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 […]

Scroll to top