binsearch magic index problem done