It is fine to use sort function during a coding interview

LORY
6 min readDec 1, 2023

Few hints about coding interview

The story

“Could you please help to solve this coding problem?”, I shared my screen.

We started with a simple binary search problem.

“Sure let me take a look”. he answered.

After 5 mins.

“I want to sort the array and then do a binary search, so let me write a sort function for this,” he said.

“Why not use array.sort()?” I asked.

“Am I allowed to use that built-in function?” He asked

“Yes, why not. please use it” I said.

After 20 mins. we started another problem. a variation of the “subset” backtracking problem.

“I am thinking of using the sliding window approach, but it seems not to solve all the cases”. he said

“Why not backtracking? do you think this is a standard subset problem?” I was giving him this hint because during the interview I do believe he has enough DSA knowledge.

“I thought about it. but I was worried that it may not be fast enough” he said.

“But the maximum input size is 20” I said.

“Okay, thanks, then backtracking is possible. let me finish the code”.

Above stories happened multiple times. that’s why I want to share with you this post.

--

--

LORY

A channel which focusing on developer growth and self improvement