Photo by Roman Synkevych on Unsplash

Given an array of strings, group anagrams together.


This is another problem with anagrams that I came across in leetcode. The problem is asking to group all the words that are anagrams of each other in an array inside yet another array. In the above example ate, eat, and tea are all anagrams of each other so they are all grouped in an array inside of a larger array.

The first…

Photo by Gayatri Malhotra on Unsplash

Write an algorithm to determine if a number is “happy”.

A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.


Photo by Markus Spiske on Unsplash

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.


  • The number of elements initialized in nums1 and nums2 are m and n respectively.
  • You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2.


My first thought with this problem was to first sort nums1 so all the 0’s would be at the beginning of the array. As long as m was the…

Photo by Victória Kubiaki on Unsplash

I was building out an admin side for an old project I had. An admin interface is something I don’t think I really came across before, but after some googling and watching youtube videos, I came across something called react admin. React Admin is a framework that allows the user to easily build an admin interface using data from an API. This is exactly what I had been looking for! I read through their tutorial and it seemed simple enough. Install react admin… I used npm so my install looked like this:

This installed react admin…

Photo by Maik Jonietz on Unsplash

I recently did a code challenge that had to do with anagrams. An anagram is two sets of letters that can be unscrambled to match each other like “apple” and “plape”. I’ve come across a simple anagram problem that just checks to see if two sets of letters are anagrams of each other. This problem was a little more complicated: Given an array of strings, remove each string that is an anagram of an earlier string, then return the remaining array in sorted order.


str = [‘code’, ‘doce’, ‘ecod’, ‘framer’, ‘frame’]

The function we create should return the following…

Photo by Irvan Smith on Unsplash

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k.

Example 1:

Example 2:

Example 3:

This is a kind of follow up to my last post about Maps in javascript because I will be using what I learned with Maps to solve…

Photo by Max Duzij on Unsplash

Some Differences

Maps are very similar to objects in javascript but there are some key differences. Objects have prototypes meaning they come with a lot of methods but Maps don’t have any of those. This makes maps easier to reason about. The key of an object has to be a string or a symbol but the key of a map can be any value including, objects or functions. Also using the size keyword you can find out how many keys you have in your map but in objects that isn’t as easily done.

Map Keywords

Maps can be instantiated by the new keyword:

Photo by W A T A R I on Unsplash

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night.

Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police.

Example 1:

Photo by John Moeses Bauan on Unsplash

Given an integer product, find the smallest positive integer the product of whose digits is equal to product. If there is no such integer, return -1 instead.


For product = 1, the output should be 11;

1 x 1 = 1 (1 is not a valid result, because it has only 1 digit)

For product = 12, the output should be 26;

2 x 6 = 12

For product = 19, the output should be -1.

No valid result found.

For product = 450, the output should be 2559.

2 x 5 x 5 x 9 = 450

For product…

Photo by Markus Spiske on Unsplash

I was working on some algorithm problems when I came across a term I haven’t really come across in my short time as a developer. That term was “set”. A set like an array is a collection of values. The most valuable part of a set is that a value in a set may only occur once. This comes in handy for many algorithm problems I have already encountered.

In the above example you can see that you can create a set using the new…

Kevin Malazarte

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