Remove alternate duplicate characters in a sentence in-place.

Given a string of characters, we aim to remove all its alternate duplicate characters in that string in-place. Let us see this with an example. We can solve this using an additional integer array of constant size of 127. Algorithm steps are as follows. For every character in the string, we insert ‘1’ in itsRead More »

Advertisements

Coin change problem (Find all number of combinations that formed a sum amount with given denominations)

Given a set of denominations of coins and an amount, our aim is find number of combinations in which we can arrange denominations to form our input amount. Let’s understand this better with following example. We can solve this problem using below two different approaches. Recursion Dynamic Programming. Recursion Let’s divide our problem into smallerRead More »