Not getting the exact output

I was able to apply the logic required but don’t know how to display the output in the given format

hello @Bhavya_Goel lets suppose your final result is in any vector or array then you can do this like this :
cout<<"[";
for(int i=0;i<v.size();i++){
cout<<v[i];
if(i!=v.size()-1){
cout<<", “;
}
}
cout<<”]";

if you still have doubt please ask here ,but if you feel that ypur doubt is clear then do hit like button and mark this doubt as resolved .
Happy Learning !!

hey @Bhavya_Goel i have also made correction in your code :


please see here .
if you still have doubt please ask here ,but if you feel that your doubt is clear then do hit like button and mark this doubt as resolved .
Happy Learning !!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.