TheChetan

No dups Sets

Sep 4th, 2020 (edited)
1,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. 4. Given a set of numbers, find the number of subsets of size 3 such that:
  2. The first number divides the second,
  3. And the second number divides third.
  4. Bonus: Extend the problem to cover subsets of size 'n'.
  5. Note: There wont be any duplicates
  6.  
  7. Ex: [1, 2, 3, 4, 5, 6]
  8. [1, 2, 4], [1, 2, 6], [1, 3, 6] = 3
  9.  
  10. Ex: [1, 3, 5, 9, 10, 90]
  11. [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