I have elements in the list in below mentioned order.
Here I have to check whether elements in the list are out of order or not.
For example in the above list 3 is out of order since it comes after 4, its not in sequential order and hence I need to report that it is out of order.
But if we can see the later occurrences of 3 (3 after 5 and 3 after 6) should not be considered because it is duplicate so only one out of order i.e 3 after 4 (the first occurrence) should be reported.
I tried to implement in java but its not working as expected.......please suggest how will I do this in simple logic because I have to check this for every element of the list.