Pergunta de entrevista da empresa Amazon

and second one was easy 2d array question where we have to find a value inside a sorted 2d arrray row wise