Given an array of strings, group anagrams together.

**Example:**

Input:["eat", "tea", "tan", "ate", "nat", "bat"],Output:

[

["ate","eat","tea"],

["nat","tan"],

["bat"]

]

Note:

All inputs will be in lowercase.

The order of your output does not matter

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…

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.

**Example:**

**Input:** 19

**Output:** true

**Explanation: **

1^2 + 9^2 = 82

8^2 + 2^2 = 68

6^2 + 8^2 = 100

1^2 + 0^2 + 0^2 = 1…

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

**Note:**

- 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*.

**Example:**

Input:

nums1 = [1,2,3,0,0,0], m = 3

nums2 = [2,5,6], n = 3Output:[1,2,2,3,5,6]

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…

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:

`npm install react-admin ra-data-json-server`

This installed react admin…

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.

Example:

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

The function we create should return the following…

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:**

**Input: **nums = [1,2,3,1], k = 3

**Output: **true

**Example 2:**

**Input: **nums = [1,0,1,1], k = 1

**Output: **true

**Example 3:**

**Input: **nums = [1,2,3,1,2,3], k = 2

**Output: **false

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…

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.

Maps can be instantiated by the new keyword:

`var…`

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:**

**Input:** [1,2,3,1]

**Output:** 4

**Explanation:** Rob house 1 (money = 1) and then rob house…

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…`

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.

let arrayOne = [1,2,1,2]let setOne = [...new Set(nums1)]

console.log(setOne)// [ 1, 2 ]

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