Multiset Equivalence Problem | C ++ program to check if two given multisets are equivalent ; sort the elements of both multisets ; Return true if both multisets are same . ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool areSame ( vector < int > & a , vector < int > & b ) { sort ( a . begin ( ) , a . end ( ) ) ; sort ( b . begin ( ) , b . end ( ) ) ; return ( a == b ) ; } int main ( ) { vector < int > a ( { 7 , 7 , 5 } ) , b ( { 7 , 5 , 5 } ) ; if ( areSame ( a , b ) ) cout << " Yes STRNEWLINE " ; else cout << " No STRNEWLINE " ; return 0 ; }