1.

Count number of sets formed by taking one element from each array

Answer»

Given THREE positive INTEGERS n, k and x. The task is to count the number of different ARRAY that can be formed of size n such that each element is between 1 to k and TWO CONSECUTIVE element are different. Also, the first and last elements of each array should be 1 and x respectively.

Examples :

Input : n = 4, k = 3, x = 2 Output : 3



Discussion

No Comment Found

Related InterviewSolutions