How to Find First and Last Position of Element in Sorted Array?