For those who are initializing pre_index as a global variable


#1

Compiler here is running the code on different test cases all at once so if your are declaring your pre_index as a global variable then it will display errors . So before calling your util func reinitialize your pre_index as 0.