DSA GRIND #7
REVERSING LINKED LIST(RECURSIVELY) The grind continues! This week we're staying on linked lists as I've been working with them a lot more given my coding class this semester. Reversing a linked list is asked commonly in coding interviews, it's more of a beginner question and I wanted to tackle it with recursion. The problem statement is very simple "Given the head of a singly linked list, reverse the list". At first, I initialized a bunch of variables to continuously swap as I traversed the link list, and while the spirit of that approach isn't wrong, I thought it more of a challenge to think through how to do this recursively. So I setup parameterized functions to compute the reversal recursively utilizing a second helper function. This was really fun! The code and solution is posted below.