Microsoft interview question

OA - 2 medium LC questions