Python Interview with a FAANG Engineer (Reverse Nodes in k-Group)
Reverse Nodes in k-Group
Watch someone solve the reverse nodes in k-group problem in an interview with a FAANG engineer and see the feedback their interviewer left them. Explore this problem and others in our library of interview replays.
Reverse Nodes in k-Group: Python Interview with a FAANG Engineer - YouTube
Interview Summary
Problem type
Reverse Nodes in k-Group
Interview question
Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.
k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it is.
You may not alter the values in the list's nodes, only nodes themselves may be changed.
Read more about the questions
Interview Feedback
Feedback about Swift Thunder (the interviewee)
Advance this person to the next round?
YesHow were their technical skills?
4/4How was their problem solving ability?
4/4What about their communication ability?
4/4
Strong pass - candidate crushed it, no major notes
Good talking through possible solutions and discussing tradeoffs Asking questions and clarifications at start - good! Discussing algorithm before coding - good! Typing out example - good! Good thinking about the edge case (e.g. not enough remaining nodes) Good discussion of options for dealing with edge case Good discussion of time complexity in tradeoffs Pseudocode vs real code - I’m fine with real code, weigh time tradeoff Good asking about boundaries of the input variables Good use of functions Creating stubs and filling out later - good technique! Good bounds checking
One thing to keep in mind with recursive solutions: stack depth! Consider using python types - good style and helps clarity Not a bad idea to throw in a couple of comments Can sometimes be good to run through examples on top of the actual code using comments Walking through an example to “test” your code is a great practice, but don’t spend too much time vs actual testing Good testing practice, don’t forget to test all edge cases
Feedback about Existential Cronut (the interviewer)
Would you want to work with this person?
YesHow excited would you be to work with them?
4/4How good were the questions?
4/4How helpful was your interviewer in guiding you to the solution(s)?
4/4
I really enjoyed the interview, you did really well in giving me the right level of assistance to keep under the time constraints. It was also pretty useful that you had prepared some extra code for testing, not all interviews are like that. I don't really have an idea of how you could improve your interviews per say.
Interview Transcript
Swift Thunder: Hello.
Existential Cronut: Hi how's it going?
Swift Thunder: Hi. It's going well. How are you doing?
Existential Cronut: I'm good. Thank you for signing up for the service. So you're looking to do an algorithmic interview, right?
Swift Thunder: Yes, I am.
Final Thoughts
Overall, the interview was successful with constructive feedback and clear communication from both parties, leading to a strong candidate assessment.