I was interviewed by Fractal in month of April 2020 for Senior Developer role.
Below are the questions I got during that 40 minutes interview-
Question 1 : Find LCA in the given binary for the given numbers.
Solution : One can see the solution on internet which I don't feel is correct. The idea which I felt correct is Here.
Question 2 : Square fence and dog puzzle.
Solution : https://www.youtube.com/watch?v=roudL8FHk2k
Question 3 : Given two four digit prime numbers, suppose 1033 and 8179, we need to find the shortest path from 1033 to
8179 by altering only single digit at a time such that every number that we get after changing a digit is prime. For
example a solution is 1033, 1733, 3733, 3739, 3779, 8779, 8179
Solution : Below is my solution, which I have not tested thorughly, neither have improved further. And it took me more than 2
hours, after interview. Please provide your feedback. Combine the code in both the images to get the complete
working code. I don't guarantee that it is giving the shortest path always, but surely it gives you the idea about the
approach. Try with any valid Integer values, except max values of 9-10 digit values.
I have attached improved version in the last which worked for 9-10 digit valid values & it took 6 hours more to have
this version.
Below are the questions I got during that 40 minutes interview-
Question 1 : Find LCA in the given binary for the given numbers.
Solution : One can see the solution on internet which I don't feel is correct. The idea which I felt correct is Here.
Question 2 : Square fence and dog puzzle.
Solution : https://www.youtube.com/watch?v=roudL8FHk2k
Question 3 : Given two four digit prime numbers, suppose 1033 and 8179, we need to find the shortest path from 1033 to
8179 by altering only single digit at a time such that every number that we get after changing a digit is prime. For
example a solution is 1033, 1733, 3733, 3739, 3779, 8779, 8179
Solution : Below is my solution, which I have not tested thorughly, neither have improved further. And it took me more than 2
hours, after interview. Please provide your feedback. Combine the code in both the images to get the complete
working code. I don't guarantee that it is giving the shortest path always, but surely it gives you the idea about the
approach. Try with any valid Integer values, except max values of 9-10 digit values.
I have attached improved version in the last which worked for 9-10 digit valid values & it took 6 hours more to have
this version.
This is a slow version, I have another version which is 100 times faster than above code. If anyone needs that please let me know.