## Wednesday, 29 April 2015

Recently, I have participated in code gladiators 2015 online programming challenge which is India's biggest coding contest and got 270/300 in first round. So, I thought to share all 3 programs which I have made in all levels.

#### Easy Level

I have got 70/100 in this level. Question was based on palindrome and I had to find the biggest palindrome length from combination of a string. In starting, I had an array of students's name and and than I had pick first latter of all name and made a string from them. Now I made an array based on combination of this string.

Input: {"Bharti", "Bharat", "Akash", "Bhaviye", "Chand", "Brijesh","Chetak", "Arvind", "Bhavna"}
Output: 7

Note: We can use Manchester code to find out biggest palindrome length but I have wrote code before knowing about this. Manchester code is better than my code.

#### Medium Level

I have got 100/100 in this level. Question was based on graph and they described as cities attack problem. They gave cities with connected road and I had to cover the longest road which covers maximum cities and I could not go back from destroyed city.

Input: {"1#2", "2#3","3#4","3#5","5#6","5#7","6#7","7#8"}
Output: 7

1#2 means city 1 is connected to city 2 and answers is maximum covered cities via a road.

Note: This program works for connected and dis-connected graph to find the maximum number of nodes via a path or this can be used to find biggest path in a graph.

#### Expert Level

Got 100/100 and this level was very easy for me. They gave an array of string and I had to find the last string from the difference of next array index to current array index.

input:    2    1   3   4
-1   2   1
3   -1
-4
output: -4

Hope, you all like this post and programs. Share it to help others.

Related Tutorials:-

Android-Geeks

Check whether a string is a Palindrome or not

Magic Square Game

Convert a given number into string

Tic Tac Toe Game