# Category: Array

## Weighted Interval Scheduling Problem

Given a list of jobs where each job has a start and finish time, and also has profit associated with it, find maximum profit subset of non-overlapping jobs.

## Box Stacking Problem

Given a set of rectangular 3D boxes, create a stack of boxes which is as tall as possible. A box can be placed on top of another box if the dimensions of the 2D base of the lower box are each strictly larger than those of the 2D base of the higher box. Multiple instances …

## Rearrange the array such that it contains positive and negative numbers at alternate positions

Given an array of integers, rearrange the array such that it contains positive and negative numbers at alternate positions. If array contains more positive or negative elements, they should be moved to end of the array.

## Calculate frequency of all elements present in an array of specified range in linear time and using constant space

Given an unsorted array of integers whose each element lies in range 0 to n-1 where n is the size of the array, calculate the frequency of all elements present in the array in linear time and using constant space.

## Print all combination of numbers from 1 to n having sum n

Given a positive integer n, print all combination of numbers from 1 to n having sum n.

## Replace each element of the array by its corresponding rank in the array

Given an array of distinct integers, replace each element of the array by its corresponding rank in the array.

## Print all Triplets in an array with sum less than or equal to given number

Given an unsorted array of integers, print all triplets in it with sum less than or equal to given number.

## Group elements of an array based on their first occurrence

Given an unsorted array of integers containing many duplicates elements, rearrange the given array such that same element appears together and relative order of first occurrence of each element remains unchanged.

## Find minimum difference between index of two given elements present in the array

Given two integers, find minimum difference between their index in a given array in linear time and single traversal of the array.

## Find maximum absolute difference between sum of two non-overlapping sub-arrays

Given an array, find the maximum absolute difference between sum of elements of two non-overlapping sub-arrays in linear time.

## Find all Symmetric Pairs in an Array of Pairs

Given an array of pairs of integers, find all symmetric pairs i.e. pairs that are mirror of each other. For instance, pairs (x, y) and (y, x) are mirrors of each other.

## Partition an array into two sub-arrays with the same sum

Given an array of integers, partition the array into two sub-arrays having the same sum of elements.