Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 4. Given a set of numbers, find the number of subsets of size 3 such that:
- The first number divides the second,
- And the second number divides third.
- Bonus: Extend the problem to cover subsets of size 'n'.
- Note: There wont be any duplicates
- Ex: [1, 2, 3, 4, 5, 6]
- [1, 2, 4], [1, 2, 6], [1, 3, 6] = 3
- Ex: [1, 3, 5, 9, 10, 90]
- [1, 3, 9], [1, 3, 90], [1, 5, 10], [1, 5, 90], [1, 9, 90], [3, 9, 90], [5, 10, 90] = 7
Advertisement
Add Comment
Please, Sign In to add comment