Is storing of elements instead of index in stack correct?

I have stored elements of circular array into stack instead of index and it is showing right answer for all the testcases. So can I store elements rather than their indices into stack?

it will not work for all testcase

if there are some duplicate numbers what will happens???

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.