Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
1,306 views

For proper oa or interview experiences list of all top tech companies visit :

https://oa.desiqna.in

https://interview.desiqna.in

 

in Online Assessments by Expert (44,360 points)
edited by

1 Answer

0 like 0 dislike

Online Assessment Question :

image

image

image

image

 

by Expert (44,360 points)
0 0
string s;
bitset<32> b(n);
int j=31;
while(b[j]==0) j--;
for(int i=j;i>=0;i--){
 s+=to_string(b[i]);
}
// cout<<s<<endl;
int cnt=0;
vector<int>v;
v.push_back(0);
for(int i=0;i<s.size();i++){
 if(s[i]=='1'){
  cnt++;
  v.push_back((i+1);
  // cout<<i+1<<" ";
 }
}
v[0]=cnt;
return v;
...