Qualcomm interview question

IO coding question