Advertisement
MuzammiL5

Iterative Subsequence

Jul 7th, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. using namespace std;
  4.  
  5.  
  6. int main(){
  7. string str = "abcd";
  8. int N = 1<<str.size();
  9. for (int i=0; i<N; i++) {
  10. for (int j=0; j<str.size(); j++) {
  11. if ((i>>j) & 1) {
  12. cout<<str[j];
  13. }
  14. }
  15. cout<<endl;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement