# extra-memory

Trapping Rain Water

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. This is a famous interview problem to learn time and space complexity optimization using various approaches. Two-pointers approach provides an efficient solution in O(n) time and O(1) space.

Find Product of Array Except Self

Given an array X[] of n integers, write a program to find an array product[] such that product[i] is equal to the product of all the elements of X[] except X[i]. We need to solve this problem without using division operations. This is an excellent problem to learn problem-solving using prefix array and a single loop.

Find maximum j – i such that A[j] > A[i]

Given an unsorted array X[] of distinct elements, write a program to find the maximum j  -  i such that j > i and X[j] > X[i].

Rotate a matrix by 90 degrees

Given an n x n 2D matrix representing an image, rotate the image by 90 degrees in an anticlockwise direction.

Remove duplicates from sorted array

Write a program to remove the duplicates from the sorted array. For this we are given a sorted array, the task is to remove the duplicate elements such that there is a single occurrence of each element in the array.

Move all Zeroes to the End of an Array

Given an array X[] of n elements filled with several integers, some of them being zeroes, write a program to move all the zeroes to the end. This is an excellent coding problem to learn space and time complexity optimization.

Equilibrium Index of an Array

Write a program to find the equilibrium index of an array. An array's equilibrium index is an index such that the sum of elements at lower indexes equals the sum of elements at higher indexes. This is an excellent coding question to learn time and space complexity optimization using several approaches.