Find the element with the longest distance in a given array where each element appears twice?

You would like to have the maximal distance, so I assume the number you search a more likely to be at the start and the end. This is why I would loop over the array from start and end at the same time.

Set iLeft index to the first element, iRight index to the second element. Increment iRight index until you find a copy of the left item or meet the end of the array. In the first case - remember distance.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions