Print all Triplets that forms Arithmetic Progression

Given a sorted array of distinct positive integers, print all triplets that forms Arithmetic Progression with integral common difference.   An Arithmetic Progression is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, the sequence 5, 7, 9, 11, 13, 15, . . . is an arithmetic progression …

Exponential search

Given a sorted array of integers and a target value, find out if a target exists in the array or not in O(log(n)) time. If target exists in the array, print index of it.

Interpolation search

Given a sorted array of integers and a target, find out if a target exists in the array or not using interpolation search. If target exists in the array, print index of it.

Remove all extra spaces from a string

Write a program to in-place remove all extra spaces from a string. There maybe leading spaces, trailing spaces, or consecutive spaces between words of the string. The solution should be able to remove them and also handle punctuation marks.