8 queen problem (backtracking)

July 5, 2018

Backtracking problems tries to create a solution tree, once previous instances pass. If condition fails at some point, it backtracks to the previous instance where it was successful, and try other possible options.

Read the rest of this entry »

Advertisements

Bit Operations

January 29, 2018

Read the rest of this entry »

SPOJ – ABA12C ( Buying Apples)

November 25, 2017

User wants to buy K kilograms of apples for N friends, and each kilogram of apples has cost attached to it. If the cost is set as -1, then user cannot buy that. User can buy as many quantity of a particular kg of apple. Minimize the cost and see if all N friends can get apples with this selection, if not print -1. Read the rest of this entry »

Coin Change – HR

October 10, 2017

Given a list of coins and a target sum, find the number of ways to make that sum. Read the rest of this entry »

SPOJ – NSTEPS

October 8, 2017

Starting from coordinate 0,0 if numbers are added to coordinates alternatively in diagonal (2 lines), find the number that is stored in x,y coordinate. If no number was stored, print “No Number”. Read the rest of this entry »

SPOJ – HMRO

October 3, 2017

Given transitive dependency of some string and duplication of the keys, use the keys that pertains to last value and the final value of the dependency to replace the original values. Read the rest of this entry »

SPOJ – ONP

October 2, 2017

Transform the expression to Reverse Polish Notation. Read the rest of this entry »

Maximum SubArray – Leetcode

October 2, 2017

Calculate the maximum sum between contiguous subarray. Read the rest of this entry »

AIBOHP – SPOJ

September 28, 2017

Find the minimum number of characters that needs to be added to a string to make is palindrome. Read the rest of this entry »

ACMAKER – SPOJ

September 28, 2017

Given a line that starts with acronym and has bunch of insignificant words. How many ways the acronym can be formed using significant (not insignificant) words so that each word has at least one char contributing to the acronym. Read the rest of this entry »