Advertisement
Hiteshw11

Create a function that takes two sets and checks if one set is a subset of the other.

Nov 17th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.30 KB | Source Code | 0 0
  1. // Create a function that takes two sets and checks if one set is a subset of the other.
  2.  
  3. void main()
  4. {
  5.   Set<int> a={1,2};
  6.   Set<int> b={1,2,3,4};
  7.   if(a.difference(b).isEmpty)
  8.   {
  9.     print("Is Set A a subset of Set B? Yes");
  10.   }
  11.   else
  12.   {
  13.     print("Is Set A a subset of Set B? No");
  14.   }
  15.  
  16. }
Tags: dart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement