Tail Recursion

Hello everyone! 👋 Today's article will be about tail recursion, a technique that allows you to optimize certain recursive functions. Introduction In short, when you write a recursive function, each new call it does allocates a frame onto the stack. For example, let us take this following function: private static long RecursiveFib(long n) { if … Continue reading Tail Recursion

LeetCode: Reverse Linked List Solution and Explanation

Hi, In this article I will explain my solution for the following LeetCode problem: Reverse Linked List. If you're interested in solving this problem then please try to spend at least one hour or more on it before looking at my solution. To help you solve this problem I've created the following table: CurrentPrev1NULL2132NULL3 Think … Continue reading LeetCode: Reverse Linked List Solution and Explanation