Easy solution findPerm

interview-questions
google
Tags: #<Tag:0x00007f2428686750> #<Tag:0x00007f2428686610>

#1
vector<int> Solution::findPerm(const string a, int b) {
vector<int>v;
int l=1,r=b;
for(int i=0;i<b-1;i++){
    if(a[i] == 'I'){
        v.push_back(l);
        l++;
    }
    else{
      v.push_back(r);
      r--;
    }
}
v.push_back(l);
return v;

}