Srini's Web Collections

Programming Problems


1. You are given an array of positive integers. you want to check whether there is a triplet(a,b,c) such that a + b = c

2.Given a number n & a prime p(< n) consider the binomial coefficients C(n,0) , C(n,1) , C(n,2), ... ,C(n,n) one wants to find out how many coefficients are not divisible by p. (try for a log(n) algo.)
3.A chess board (NxN) is given. you want to place knights such that no attack each other & no 2 control the same position. |--|--|--|--|--|--|--| | A| | | | | | B| |--|--|--|--|--|--|--| | | |a | | *| | | |--|--|--|--|--|--|--| | | | | | | | b| |--|--|--|--|--|--|--| in the above grid the 2 knights(position marked A & a) are attacking each other & the 2 knights (position marked B & b ) control the same position( marked Bp addresses baahar bo chummi header iitians mail mankars sendits.sh slocat.sh time xaa xab xac xad xae xaf xag xah xai xaj xak xal xam xan ); you have to give the maximum no. of knights that u can place.
4.Given a string one wants to find out the shortest even palindrome starting from the first index. e.g 1.aabbaa now there are 2 even palindromes(starting from the 1st index) aa & aabbaa. thus the answer is aa. 2.abb although bb is a palindrome but it doesn't start from 1st index thus answer -1.