Welcome back to yet another week of solving popular algorithms. Once again we will be looking at a leetcode problem. Today’s is a pretty fun one called Split a String in Balanced Strings.

Without further ado, let’s jump right into solving this problem!

A kitty trying to find balance

The Problem

You are probably wondering what a balanced string is and that is an excellent question. For the purpose of this problem, a balanced string will be considered a string that has an equal number of ‘L’ and ‘R’ characters. …

Welcome back to another week of solving algorithms on leet code. Today, we are going to be looking at a quick and easy algorithm that I think is perfect for beginners: Number of Good Pairs.

What our algorithm needs to say to the pairs…

The Problem

The goal of this problem is, given an array of integers, to find the number of “good” pairs contained in the array and return that number.

Now, a pair is good if it meets two basic criteria. First, if the numbers are the same and second, if the index of the first number is…

Welcome back to another week of tackling algorithms. Today, we are going to be looking at a leetcode problem called Self Dividing Numbers. This problem, while not too difficult, did require a bit more creative thinking and I think it will be a great problem to give a go if you are just starting out solving algorithms.

Too true, Gordon.

The Problem

You might be wondering what a “self dividing number” is. Basically, a self dividing number is a number who can be evenly divided (aka with a remainder of 0) by every digit in the number. For example, 128…

I’m not going to lie: I clicked on this problem because I thought it would be easy. I mean, it’s just adding strings right? How hard could it be?

Well, much to my surprise and, honestly, irritation, this problem was actually kind of challenging as adding large numbers without BigInt seemed like a logistical nightmare. And it is.

But, logistical nightmares often make us better, more adaptable coders. So even if you, like me, look at this problem and have no desire to even attempt a solution, I promise it will be worth it in the end!

Thus, without further…

I feel like it’s been a while since I’ve actually sat down to solve an algorithm. I mean, it’s been over a week, which I guess is a long time on someone’s scale. Like a fly. A week is a very long time for a fly.

I don’t really know where I’m going with this, so instead let’s move on and get right into explaining the problem we are going to be solving today: Shuffle the Array.

Before we begin, I do want to quickly note that this problem is actually quite similar (though a lot easier…) to another very…

Another week, another algorithm to solve…

This week we are going to be tackling another LeetCode problem. The problem is called Matrix Diagonal Sums and while it seems quite easy, it has a few tricky elements that I think are definitely worth going over. So, without further ado, let’s jump right into solving this problem!

This is the wrong type of matrix

The Problem

The goal of this problem is, given a square matrix, to sum numbers across both diagonals of the square.

Example of Matrix Diagonals via LeetCode

If you are new to matrices, don’t worry. For the purposes of this problem, you can understand…

Welcome back to another week of Hope explaining her problem solving strategy to the void. Today, we are going to be looking at another LeetCode problem called Replace All “?”s to Avoid Consecutive Repeating Characters. I actually really enjoyed the process of solving this problem and think some of the methods I used to solve it are generally quite helpful problem solving practices. So let’s jump right in!

Cute doggy + ?s

The Problem

The goal of this problem is, given a string of characters, to replace any ? …

I’ve had a hectic week moving into a new place (fourth and last time this year!) and during the chaos my algorithm practice has fallen to the wayside. So, in order to get back into the swing of things, I decided this week that we’d take a look at an easy beginner problem: Average Salary Excluding the Minimum and Maximum.

If you’re just starting out solving algorithms or like me have taken a bit of a break and need to get back on the wagon, then I’d definitely say this problem is a great place to start!

Because it means…

Today, I want to share one of my go-to algorithm solving techniques: hash maps.

Hash maps are a data structure that go by many names. In Python, we call them dictionaries. In Ruby, they are just called hashes. And, in JavaScript, we call them objects. Regardless of what you call them, however, they are a super common and super helpful data structure that will help us solve many different algorithms.

If you’d like to know more about what hash maps are please check out my previous blog as in this blog we are going to focus on seeing this data…

If you are a returning reader, welcome back! And if you are a first time reader, welcome! Today, we are going to be taking a look at another popular leet code algorithm: String Matching in an Array.

I actually think this is a great problem for beginners and I wish personally that I had looked at this problem a lot sooner myself. So if you are new to algorithms or even just coding in general, I’d suggest you stick around and we can figure out how to solve this problem together!

I think the mayor needs help with that string!


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store