Apple | SDE | Failed and seeking solution!

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-01-31Added By Anonymous
Source: Link

I got two rounds of phone screening.


the first round was not bad, they asked me to do self-introduction and asked several questions based on my experience, then we start coderpad testing, four questions involved this time.

https://leetcode.com/problems/valid-perfect-square/

https://leetcode.com/problems/coin-change-2/

https://leetcode.com/problems/reverse-string/

https://leetcode.com/problems/reverse-integer/


then I receieved an system generated email for the second round of the phone interview. they only asked one question and I was not able to find a good solution. I didn't find the problem here, so I'm including the description below, hopefully someone could help to solve this problem.


input: list contains number from 1 to n


output should be a re-arranged list, with the format like this [1,3,6,10,15...]


which has the following capability:

a). the sum of each adjacent pair should be a valid perfect square, like 1+3=2^2, 3+6=3^2, 6+10=4^2, 10+15=5^2, etc.


this should be a graph problem, need sharpe brains within this community to find out a good approach to solve this problem, thanks in advance!!!

Comments