Not understanding the problem


#1

How answer to 5 3 -1 4 -1 -1
2 is 4 and not 3.

tree will be
3

4

Second largest number is 3 so answer should be 3.


#2

My ans is 3 for same input that means u r doing same mistake as i did before if u using global var in code then initialize that var in given kthsmallest() function