Back

find the second smallest element?

Created 2 years ago
53 Views
1 Comments
SakthivelHmOLkh
@SakthivelHmOLkh
SakthivelHmOLkh
@SakthivelHmOLkhProfile is locked. Login

82)Array

Given a number N followed by N elements, find the second smallest element.If it cannot be found then print -1
Input Size : N <= 100000 (ie do it in O(log n) time complexity)
Sample Testcase :
INPUT
5
1 2 3 4 5
OUTPUT
2

Comments
Please login to comment.