mercredi 17 février 2021

Count number of subsequences of the array that form valid form of number with no of digits = k

This is a hackerEarth problem I didn't get any proper explanation for this problem. Please help in explaining the solution for this problem.

Given an array of integers. Each integer is a single digit number in the range [0-9]. You are also given a number K. Now, you need to count how many subsequences of the array A exist such that they form a K digit valid number.

A subsequence of size is called a valid number if there are no leading zeros in the number formed.

i/p:

5
1 1 0 1 0
3

o/p:

9

Aucun commentaire:

Enregistrer un commentaire