for randominsertupdatedelete test case I am getting wrong answer. it required list till lineno999 but i am getting till lineno998 only. if i add lineno999 by myself for debugging purpose then it gives ans till lineno997 and lineno999 that is it removes lineno998. I am not able to understand why this is giving such output.I think somewhere size of list got fixed but i am not able to find out the exact reason.please help.
test is passing for N=586 but fail after N=587.
Hey @Richa_Arya In case you are using sublist method as array.sublist(StartIndex, EndIndex) remember it returns a sublist between startIndex(included) and endIndex(excluded).
For example suppose you have an array with 10 elements, lets name that arr.
When you will use arr.sublist(0, 9) it will return a list with elements from index 0 to 8 (As final index is excluded in returned list). So you need to pass arguments for sublist accordingly. Hope this helps and do let me know if it doesnt too
@Richa_Arya I just checked your workspace, you were using removeRange, this is not required, you can use something like subList as @Kunal has suggestted.
Also you don’t have to implement the application logic in Handler class, you only have to implement the ones in version Class.
Refer to the apply(Update Lines) function in Version class.
You only have to call the version class method in this.
with the argument being update lines.
You can use something like subList(x,y).clear().
Make sure you read the definition of subList properly.
For example if the arguments are subList(10,20).
the lines will extracted from 10-19.
Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.