## Sums in a Triangle Codechef Solution

Let’s consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three in the third line, etc. Develop a program which will compute the largest of the sums of numbers that appear on the paths starting from the top towards the base, so that: …

## Lapindromes Codechef Solution

Lapindrome is defined as a string which when split in the middle, gives two halves having the same characters and same frequency of each character. If there are odd number of characters in the string, we ignore the middle character and check for lapindrome. For example gaga is a lapindrome, since the two halves ga and ga have the same characters …

## Gross Salary Codechef Solution

In a company an emplopyee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of base salary and DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. …

## The Smallest Pair Codechef Solution

You are given a sequence a1, a2, …, aN. Find the smallest possible value of ai + aj, where 1 ≤ i < j ≤ N. Input The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.  The first line of each description consists of a single integer N. …

## Ambiguous Permutations Codechef Solution

Some programming contest problems are really tricky: not only do they require a different output format from what you might have expected, but also the sample output does not show the difference. For an example, let us look at permutations. A permutation of the integers 1 to n is an ordering of these integers. So the natural …

## Cutting Recipes Codechef Solution

The chef has a recipe he wishes to use for his guests, but the recipe will make far more food than he can serve to the guests. The chef therefore would like to make a reduced version of the recipe which has the same ratios of ingredients but makes less food. The chef, however, does …