Unable to understand the expected test result. 97->63->


#1

This question has already been asked but it was never answered and it doesn’t look like the problem has been fixed.

For the input below
..-> 49 -> 32 -> 68 ->..
the expected result is:
.. -> 68 -> 32 -> 49 -> ..
Why?
My understanding is that since B=13 and C=15 are not present in the list the returned result would be the same as the input (without any changes). If it is not a bug then there must be some explanation to this.
Hope someone replies so I can update my code accordingly.



A : [ 97 -> 63 -> 89 -> 34 -> 82 -> 95 -> 4 -> 70 -> 14 -> 41 -> 38 -> 83 -> 49 -> 32 -> 68 -> 56 -> 99 -> 52 -> 33 -> 54 ] B : 13 C : 15

Your function returned the following :

97 -> 63 -> 89 -> 34 -> 82 -> 95 -> 4 -> 70 -> 14 -> 41 -> 38 -> 83 -> 49 -> 32 -> 68 -> 56 -> 99 -> 52 -> 33 -> 54

The expected returned value :

97 -> 63 -> 89 -> 34 -> 82 -> 95 -> 4 -> 70 -> 14 -> 41 -> 38 -> 83 -> 68 -> 32 -> 49 -> 56 -> 99 -> 52 -> 33 -> 54


Thanks


#2

Hi @shakeels . First of all, the input and the expected output are absolutely correct and there is no bug. Let me clarify.
Basically you have mistaken B and C as values in the linked list, but actually B and C are not values, rather they are positions (linked list to be assumed as 1-indexed). Read the first line of question properly!! So if you count, 49 comes at position 13 and 68 comes at position 15. Now you simply revert from position 13 to position 15 and your answer is .. -> 68 -> 32 -> 49 -> ...

N.B. : The example given in the question might have confused many because m=2 and n=4 are also values placed at positions 2 and 4 as a coincidence (LOL).


#3

what about the code clearing all test cases, and many cases after submitting. were they
also “by coincidence” just like example given. I have seen many poorly explained problems like this. Interview bit can go f*** themselves.