Home Google interview question 3 byFoody -March 20, 2021 1 question find the permutation of a giiven string Input: ""WORD""solution#include<iostream>using namespace std;int main(){ string s; string c; cin>>s; c=s; for(int i=0;i<c.size();i++){ c=s; c[i]=1; cout<<c<<endl; } for(int i=0;i<3;i++){ c=s; c[i]=3; c.erase (i+1,i+1); cout<<c<<endl; } for(int i=0;i<3;i++){ for(int j=1;j<5;j++){ c=s; c[i]=1; c[j]=1; if(i!=j &&j<4 && j!=i+1 && j>i){ cout<<c<<endl; } } } for(int i=0;i<3;i++) { c=s; c[i]=3; c.erase (i+1,i+1); } return 0;} Facebook Twitter
Machine Learning
ReplyDeleteMachine Learning Machine Learning Machine Learning
Machine Learning Machine Learning Machine Learning Machine Learning Machine Learning