Showing wrong answer

code link:

hey @frzkaleem it is incorrect to assume the the first rose would come from the first half of the string and second rose would come from the second half of the string for example in case of
7
1 2 3 4 5 5 9
answer is 5, 5 both belongs to second half of the string so, binary search from arr+i+1 instead of arr+n/2 and there is no need to check for if n is odd or even,

Updated Code:

it is till now showing wrong ans

the code that i gave you is passing test case, please check again