this is the link to my code plz check and tell for what cases it failing acc to me the logic is correct.
https://onlinegdb.com/HJynI7CGD
@asinghal1_be19 since you are duplicating the array but never consider from where array is starting and where should it end like run for this test case you will get it:
1
3
1 1 1
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.
shall i try nested for to keep track from where it started and where it end.
hello @asinghal1_be19 as i have seen your submission. your code is not passing any of the test case . the logic you are using of doubling the size of the array will give you result but for the other test cases it will not pass because the test cases are larger . there is more optimised approach for it .
here for your reference i am atttaching the code .
https://ide.codingblocks.com/s/327571.
if you have any doubt please let me know .
Happy Learning !!
hello @asinghal1_be19 as you are not responding i feel your doubt is cleared .That 's why i request you to please 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.