For this blog, I’ll be going over another popular problem on LeetCode. Note that I’ll be using JavaScript to solve this problem! Here’s the prompt:

In other words, the prompt is asking us to create a function that takes in an array of strings and returns an array with subarrays. These subarrays will contain the different types of phrases that can be created with the same letters. The examples are very helpful in demonstrating what the inputs and outputs should be!

Before doing any code, the first step should always be planning ahead or pseudo code. So let’s start with…


For this blog, I’ll be going over another popular problem on LeetCode. Note that I’ll be using JavaScript to solve this problem! Here’s the prompt:

In other words, the question is asking us to create a function that takes in an array nums and returns the length of a new array where the duplicate is removed. The examples on the picture above do a great job showing what the inputs and outputs should be for this problem. Example #1 is showing how the output should be an integer which in this case is the array length.

I always plan before…


For this blog, I’ll be going over another popular problem on LeetCode. Note that I’ll be using JavaScript to solve this problem! Here’s the prompt:

In other words, the question is asking us to create a function that takes in an array nums and returns an array with the running sums. The examples on the picture above do a great job showing what the inputs and outputs should be for this problem. Example 1 is showing how the output should be an array of results that depend on the input array. For example, my input is [1,2,3,4] and my output…


As mentioned in my previous blog, I’ll be going over another solution for this question that’s very efficient. Keep in mind that this question will be solved in JavaScript! In case you didn’t read my last blog, here’s the prompt:

In my last blog, I used hash tables to solve this problem. For this blog, I’ll be covering how to solve this problem using Sets. Sets are very similar to hash tables in the sense that they’re both objects. For more info on Sets make sure to check out the resources section below.

To start off, I’ll create a variable…


For this blog, I’ll be going over another popular problem on LeetCode. Note that I’ll be using JavaScript to solve this problem!

In other words, the question is asking us to create a function that takes a string as an argument and all we have to do is return a boolean value. The examples do a great job of showing what the input and outputs should be for this problem. For example 1, we can see that the output is true because the string contains every single letter of the alphabet. The output for example 2 is false because not…


For this blog, I’ll be going over another popular problem on LeetCode. Note that I’ll be using JavaScript to solve this problem!

In simpler terms, the question is asking us to create a function that would pick two numbers (i and j) that when subtracted by 1 and multiplied to each other it can return the maximum product. The examples do a great job of showing what the input and outputs should be for this problem. For example #1, we can see that the output is 12 because after iterating through the entire array, the function chose numbers 4 and…


For this blog, I’ll be going over what Dynamic Programming is. Learning this topic was challenging especially since there’s not many resources out there that simplify the complexity of Dynamic Programming. I’ll be using the Fibonacci sequence problem as an example, as well as different ways to solve the problem in JavaScript. I hope that I can at least make this topic a bit more understandable for you all!

Dynamic Programming:

Dynamic Programming is used for solving a complex problem by breaking it down into a collection of simpler subproblems solving each of those subproblems just once, and storing the solutions.

Overlapping Subproblems:

A…


For this blog, I’ll be going over another popular problem which is Array Chunk. Note that I’ll be using JavaScript to solve this problem!

The problem tells us that we need to create a function where it holds an array and chunk size (integer) as arguments. The goal of this function is to divide arrays into subarrays depending on the chunk size. The examples from lines 6–10 form the screen shot above do a great job in showing what the input and outputs for this function should be. Based on the first example, we have an array with a length…


Intro:

For this blog I’ll be solving another popular algorithm problem from LeetCode, Palindrome Number. Note that this problem will be solved in JavaScript! I’ll also be demonstrating three ways in which we can solve this problem.

The question is asking us to return true if the number is a palindrome. A palindrome is a number that when you reverse it, it’s still the same number. By going over the examples, I also realized that if the input is a negative number (-101) then the boolean value in return should be false. So let’s begin!

Using Built-In Methods:

Here are the built-in methods that…


For this blog I’ll be solving another popular algorithm problem, Max Character. Note that this problem will be solved in JavaScript!

The question is asking us to create a function that returns the character that’s used the most in a string. Judging from the examples on lines 6 and 7, both the input and output should be strings. My solution for this problem has a time complexity of O(n)!

Using arrays would be a great way to solve this problem, but I’m going to use hash tables just to show another way of solving this problem. I created a variable…

Bryam Vicente

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