I am getting segmentation fault for this question what is going wrong in the code?
PLaying Cards Stacks
You have made the approach a bit complex.
If you want me to check your apraoch/code, add some comments.
Here is another approach : Playing with cards
You can refer this implementation
Can u correct my code?
i am basically using a vector a and b
for every iteration q,i am copying the vector a in another vector v.
then i am iterating over the vector v and doing divisibility check with ith prime if its divisible i push it into b else into a
i am passing vectors by reference so change will be reflected in each function call
And in the end i am trying to print the vectors a and b from the end
Hope this helps.
The code is same as before
and after copying into vector v i am also clearing vector a but keeping vector b as same and passing it in next function call
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.