Question d’entretien chez Comcast

Asked to write code for algorithm/use inbuilt function and time complexity of it