Redirecting to

No Max No Min

You have an array with n elements. you have to create all subsequences of this array with length K. For each subsequence, you have to write down the product of k-2 integers, all elements of this sequence except the minimum and maximum element.
your work will be considered done if you will be able to write down all these numbers and tell PepBoss their product mod 10^9+7.
Input Format
The first line contains integer N (length of array) and K.
The second line contains N space separated integers.
Output Format
Print a single line containing one integer - the product of all numbers written down by you modulo 10^9+7.
Question Video
1<= N <= 5000
3 <= K <= N
1 <= arr[i] <= 10000
Sample Input
4 3 
1 2 3 4
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name