Intersection of Arrays


I don’t know how to use ArrayList in this question. Otherwise, I think my code is working fine. Please tell me how to print my result in the given format.

Hi kajal ,
At line 31 ,instead of for(i=0;i<result.size()-2;i++) you should have for(i=0;i<=result.size()-2;i++) (you missed the equality sign ) as you are printing result.size()-1 elements and for the last element ,at line 33 you should not increment as when loop gets exhausted i will already have the value of result.size()-1 thus printing last value
refer this : https://ide.codingblocks.com/s/180161

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.