Count number of subsequences such that all elements in each subsequence have same frequency.
Anonymous User
3402

How to Count the number of non-empty subsequences in an array such that all elements present in each subsequence have the same frequency?
How to do it in polynomial time complexity? What will be the logic for the solution? ** Is there any mathematical trick here?**

The order does not matter. We are considering each subsequence at a time and checking if they are satisfying the condition. So how many subsequences will be possible?

Eg- Input is [2,4,2] The output is 6. Total 6 such subsequences are there- [2],[4],[2],[2,4],[4,2],[2,2]

Comments (4)