Given an array of integers and a target value, return the indices of 2 numbers that add up to the input target value. The first “two sum” in our example is 8 and 2, because they add up to 10. LeetCode also asks us to return the indices which are…
Design HashMap LeetCode Interview Question (Explained Simply)
Hash maps are used to store data in key-value pairs. They are similar to arrays because arrays values are stored against numeric keys known as indexes. Hash maps allow us to have flexible keys. The upside to hash maps is that they have lighting fast searches and insertions. The downside…
Missing Number LeetCode Question (Explained Simply)
Given an array of numbers, that are all distinct, return the only number in the range that is missing. This question wants you to find the missing number in sequence of arrays, example: In the example above, the number we want to find is 5. Steps
Nullable Types in C# (Explained Simply)
For decades developers have fought over null types. What do they mean? Why is there a silly little question mark in my C# code? What is consciousness? These are all topics that we will tackle in this blog post. Prerequisite In order to correctly understand nulls you must know the…
Model State in .NET Core (Explained Simply)
When we first start building API’s we make many assumptions about our users. We assume that they would never input bad data. This is very unrealistic. Have you ever experienced the frustration of filling out a long form at the dentist office? This is the exact same feeling users have…
FirstOrDefault in EF Core (Explained Simply)
Many times in life we just want one thing. This is no exception for C# and when we are working with database entities. When you want a single entity from a database, you will be given the choice of a few methods: FirstOrDefault() FirstOrDefault() returns the first element that satisfies…
Algorithm Patterns 101: Array Swaps
Array swapping is an algorithm pattern that is used constantly in a variety of interview questions and sorting algorithms. To put in simply, array swapping is just switching two array elements. In our example, we have an array of numbers. We want to swap the element at index 1 (which…
Move Zeroes LeetCode Interview Question (Explained Simply)
The title of this LeetCode questions is very ambiguous and does not do a great job explaining what it actually does. All this interview question is asking you to do is move the zeros to the end of an array. That’s it. Before: After: 2-Pointer Step-By-Step (In-Place)
Valid Mountain Array in Java (Explained Simply)
Essentially, this Leetcode question is asking “do the numbers in an array go up then go down“. It’s called a mountain array because if you draw a line tracing the path of the numbers it will look something like this: The following conditions must apply: Another way to describe this…
Repository Pattern Explained Simply
Repository Pattern is likely the only design pattern you will implement as software developer. %99 of software design patterns are very rarely implemented, but the repository pattern is something you will see everyday. First, let’s just see a Repository Pattern and what it is: All this code does is get…