## Length of the longest alternating subarray

Given an array of N including positive and negative numbers only. The task is to find the length of the longest alternating (means negative-positive-negative or… Read More »

- Rearrange Odd and Even values in Alternate Fashion in Ascending Order
- Split the array and add the first part to the end | Set 2
- Length of the longest alternating subarray
- Rearrange an array to maximize i*arr[i]
- Arrange first N natural numbers such that absolute difference between all adjacent elements > 1
- Segregating negative and positive maintaining order and O(1) space
- Rearrange all elements of array which are multiples of x in increasing order
- Maximum number of fixed points using atmost 1 swap
- Arrange a binary string to get maximum value within a range of indices

Given an array of N including positive and negative numbers only. The task is to find the length of the longest alternating (means negative-positive-negative or… Read More »

Given an integer N. The task is to find the permutation of first N natural numbers such that the absolute difference between any two consecutive… Read More »

Given an array of integers (both odd and even), the task is to arrange them in such a way that odd and even values come… Read More »

Given an array of N integers, you have to select all of these integers in any order. For every integer you select, you get points… Read More »

Given an array of integers ‘arr’ and a number x, the task is to sort all the elements which are multiples of x of the… Read More »

Given a string consisting of only 0’s and 1’s. Now you are given N non-intersecting ranges L, R ( L <= R), more specifically [L1,… Read More »

Given a permutation of N elements (Elements are in range 0 to N-1). A fixed point is an index at which the value is same… Read More »

Given an array and split it from a specified position, and move the first part of array add to the end. Examples: Input : arr[]… Read More »

Segregation of negative and positive numbers in an array without using extra space, and maintaining insertion order and in O(n) time complexity. Examples: Input :9… Read More »

In-place has more than one definitions. One strict definition is. An in-place algorithm is an algorithm that does not need an extra space and produces… Read More »

Given an array of 2 * N positive integers where each array element lies between 1 to N and appears exactly twice in the array.… Read More »

Given an array of n integers, both negative and positive, partition them into two different arrays without comparing any element with 0. Examples: Input :… Read More »

Given an array of integers, segregate even and odd numbers in the array. All the even numbers should be present first, and then the odd… Read More »

You are given an array of size ‘n’. You have to replace every pair of consecutive values ‘x’ by a single value ‘x+1’ every time… Read More »

Given a matrix m[ ][ ] of size n x n consisting of integers and given a character ‘x’ indicating the direction. Value of ‘x’… Read More »