Category Archives: codechef


CodeChef : December Challenge 2017 – Chef And his Cake

Chef And his Cake Source: CodeChef Chef’s girlfriend’s birthday is near, so he wants to surprise her by making a special cake for her. Chef knows that his girlfriend likes cherries on the cake, so he puts cherries on the top of the cake, but he was not satisfied. Therefore, he decided to replace some of the cherries… Read More »

CodeChef : November Challenge 2017 – Periodic Palindrome Construction

Periodic Palindrome Construction Source: CodeChef Chef recently learned about concept of periodicity of strings. A string is said to have a period P, if P divides N and for each i, the i-th of character of the string is same as i-Pthcharacter (provided it exists), e.g. “abab” has a period P = 2, It also has a period of P = 4, but it doesn’t have… Read More »

CodeChef : November Challenge 2017 – Chef goes Left Right Left

Chef goes Left Right Left Source: CodeChef Chef is at a Code Expo where many coders are present discussing, solving, sharing, and eavesdropping on solutions 😛 He recently learnt that a former HackerPlant employee, Reziba, who is now working at KodeKarma stole some questions for their KoolKontest. Chef wants to find Reziba, but the only data he has… Read More »

CodeChef : November Challenge 2017 – Villages and Tribes

Villages and Tribes Source: CodeChef There are n villages in a line in an area. There are two kinds of tribes A and B that reside there. A village can be either empty or occupied by one of the tribes. An empty village is said to be controlled by a tribe of village A if it is surrounded by villages… Read More »

CodeChef : October Challenge 2017 – Counter Test For CHEFSUM

Counter Test For CHEFSUM Source: CodeChef Counter Test For CHEFSUM : Once Chef was writing test data for the problem CHEFSUM . For your convenience, the summary of this problem is provided as below. You are given an array a of size n. Let prefSum[i] denote the sum of first i elements and sufSum[i] denote the sum of last n – i + 1 elements of the array a. You have to… Read More »