0

What is the problem with this code?

In this code i am getting an output one but not the desired output https://code.sololearn.com/cJ9OU30sXSVL

22nd Jun 2020, 6:29 AM
Abhishek Dimri
Abhishek Dimri - avatar
5 Réponses
+ 2
I haven't tried to run the code yet, but can you describe the problem more descriptively. Idk if I can help, but maybe I can try something if I can understand the situation better.
22nd Jun 2020, 8:40 AM
Ipang
+ 2
Abhishek Dimri You included <vector> header but you are using array, why though? I'm not sure but, does the requirement say that the values must be rearranged in-place (directly in the original container)? are we allowed to create new array or std::vector which contains the values in such arrangement? I think I have an idea if we were allowed to use another container to store the values in new arrangement. We can create a new container in the `arrange` function, and fill it up in such manner.
22nd Jun 2020, 2:58 PM
Ipang
+ 1
Ipang There is a problem in Geeksforgeeks name Rearrange Alternately some thing like that and rest is written on the documentation section of the code
22nd Jun 2020, 12:48 PM
Abhishek Dimri
Abhishek Dimri - avatar
+ 1
Ipang no we are not allowed to use another array because space complexity given is O(1)
22nd Jun 2020, 4:36 PM
Abhishek Dimri
Abhishek Dimri - avatar
+ 1
Abhishek Dimri In that case, things get a bit more complicated. I'll post back here if I get an idea how to work it out. In the meantime I hope someone more capable could come up with something.
22nd Jun 2020, 4:47 PM
Ipang