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
Programming
Constructor Injection and Null Object Design Patterns
The Constructor Injection design pattern is a pattern that helps you declare all the required dependencies of a class in it's constructor. This is useful because it helps you decouple the code, you can specify an interface instead of a concrete type, remember, program to an interface. Also, in the constructor it is easier to … Continue reading Constructor Injection and Null Object Design Patterns
Composition Root Pattern: How to Write Modular Software
The composition root is a design pattern which helps you structure a software application by implementing a class that builds all the other classes. In this example we will examine this pattern in Python. Here's the object graph of the classes that we're going to implement: I have designed a sample application that we're going … Continue reading Composition Root Pattern: How to Write Modular Software
LeetCode: Flood Fill
Hello, Here's my solution for the flood fill problem, found on LeetCode. If you want me to write about certain topics please let me know in the comments, thank you! Link to the problem: https://leetcode.com/problems/flood-fill/ """ An image is represented by a 2-D array of integers, each integer representing the pixel value of the image … Continue reading LeetCode: Flood Fill