Problem with Test Case 2

The number of input array-elements should be 1,000, but instead 10,000 array-elements are given in Test Case 2.

Even if we take first 1,000 array-elements out of 10,000 provided, the ‘solution obtained on local-computer’ != ‘soultion provided on codingblocks’

OR if we process all 10,000 array-elements, still the ‘solution obtained on local-computer’ != ‘solution provided on codingblocks’

Sorry, I am talking about “Test Case 1” above but typed Test-Case-2 instead

The total number of elements of the given array will not exceed 10,000.
this is the constraint not 1000

Sorry, I could not explain it well but I am not talking about constraint, according to the input-format total array-elements would be - NxM (10x100 = 1,000 array-elements should be here), but instaed they provided 10,000 array-elements. But the main issue is the Answer gets wrongs for Test-Case-1, even if solution is correct

see this code:

The code you provided above is not working for sample input provided in the question-

3 3
1 2 3 4 5 6 7 8 9

Output using your code is :

Out of Bound!!!
18 5 3

While the output should be -

1 2 4 7 5 3 6 8 9