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

LeetCode: Arrays 101: Inserting Items Into an Array

Hello, Here are my solutions for the second part of the card: Arrays 101, from LeetCode. Duplicate Zeroes Given an array of integers, remove duplicate zeroes and shift the remaining elements. https://leetcode.com/problems/duplicate-zeros/ class Solution: def duplicateZeros(self, arr: List[int]) -> None: """ Do not return anything, modify arr in-place instead. """ index = 0 arr_length = … Continue reading LeetCode: Arrays 101: Inserting Items Into an Array