Uber Interview Question

1. Sort array after converting elements to their squares Input : arr[] = {-6, -3, -1, 2, 4, 5} Output : 1, 4, 9, 16, 25, 36

Interview Answer

Anonymous

Jul 23, 2019

1. Question 1 Approach 1: Did using 2 pointer approach. Compare the the absolute values of 1st and last element and place the square on correct position. I've also discussed 2 other approaches. Corrected the interviewer for the time complexity.