This week I encountered many interval questions in binarysearch.com and leetcode. Since I struggle from time to time on this topic, I would love to write a blog regarding interval topics. Today we are going to discuss leetcode #435 Non-overlapping Intervals.

Here is the question:

Back at it again with another algorithm blog! Today we will talk about one of the popular questions in Leetcode, #647 Palindromic Substrings. There are many ways to solve this problem. We are going to talk about ‘ expand around possible centers here.

Here is the question:

We want to return the number of ways to obtain a non-empty palindrome by trimming the string’s left and right sides (but without rearranging the string). As long as it produces a palindrome, the left and right trims can also be empty.

The intuition of ‘expand around possible centers’ is that palindromes are like onions, you remove the boundary characters, and you are left with another, a smaller palindrome. Palindromes have the same centers; with those centers, we can expand around them, and from there, we can find substring palindromes as long as we can make larger and larger palindromes. For instance: let’s take the string ‘never’ if we choose ‘v’ as the center ‘v’ and ‘eve’ are palindrome. But the final expansion ‘never’ is not a palindrome since the first and last characters are not matched. …

Hello, today’s topic is back at it again with the algorithms blog. Today we are going to talk about leetcode question #724 Find Pivot Index. Before we are trying to solve the question, we should understand what prefix sum is.

Prefix sum in the array is iterating through index 1 to last and adding the present element with the previous value. People also called this term cumulative sum, inclusive scan, or scan of the sequence number. The intuition behind this is that the prefix array’s previous position will have the previous elements' sum. In that way, we can find the total sum up to a certain point by checking the prefix sum array’s value. We don’t need to go through each time to know the value between two positions in the array with a prefix sum array. …

This week’s blog is going to be different than usual. Let’s take a break from tech and talk about human beings. Recently I saw many people talking about imposter Syndrome in the job searching process. Imposter syndrome is a common experience for everyone; we all have been through imposter syndrome somewhere in our lifetime. Today I want to share my three simple principles on how I avoid imposter syndrome. I hope this article can help and reduce your imposter syndrome in many ways.

Developers often spend much time deciding the correct data structure to use. Choosing the right data structure can make it easier to operate data, saving time, and making code more comprehensive. The two most prevailing data structures for storing collections of data are Objects and Arrays. Developers use Objects to store key/value pairs and Arrays to store indexed lists. However, ECMAScript 2015 introduced two new types of iterable objects: Sets and Maps; these are ‘keyed collections,’ which means their behavior is slightly different and offers performance advantages.

There are two main differences between Map and a traditional Object in Javascript.

Iterating over keys, values, or entries in a regular object, we must convert them to an array, utilize a method such as an Object.keys(), Object.values(), Object.entries or for…in loop.The …

This article will show a quick introduction of a for loop, a forEach, a for of, and a for in. We are going to talk about what are their differences and similarities in this article.

This method is the most traditional type of iteration in Javascript. It takes three expressions; a variable declaration and expression to be evaluated before each iteration, and an expression to be evaluated after each iteration. Let's dive into an example.

As we all know, the most popular paradigm of today technology is Object Oriented Programming(OOP). Today in top companies’ technical interviews, you need to know about solving algorithms and data structure problems and be able to explain the basic principles of Object-Oriented Programming as well as System design principles (this will be another blog topic). If you are programming with this particular paradigm, you will often hear interviewers asking the four basic principles of Object-Oriented Programming.

- Encapsulation is the mechanism of hiding data implementation by restraining access to public methods. Instance variables are kept private, and accessor methods are made public to achieve this. We are encapsulating the properties within the Object by setting properties as private. …

The greedy algorithm is essentially similar to other algorithm pattern approaches that I wrote to solve pattern journals(divide and conquer, Two pointers, sliding windows, frequency counter). It is designed for solving* optimization problems*; optimization problems are problem demands or require either minimum or maximum result; this includes the Greedy method, Dynamic Programming, and Branch and Bound. However, the approaches between these terms are different, but they are all under optimization problems.

A greedy algorithm makes greedy choices to ensure it is efficient and optimized. It is an algorithm paradigm that follows the problem-solving approach of making the locally optimal choice at each stage with the hope of finding a global optimum. …

Back at again with the data structure and algorithm journal. In the last journal of the data structure, we talk about *binary search trees*. In this article, we are going to dive into how we traversal a tree. Not necessarily a binary search tree, it could be a binary tree that’s unsorted or a ternary tree or just any other tree that has no particular order.

Let’s contrast it with a linked list to traverse a tree for every node one time. In the linked list, we only have one linear pathway from head to tail when traveling a singly linked list, no order whatsoever to decide. With a tree data structure, it is very different. There are a lot of ways to visit every node at once. It is not like a linked list, just one linear approach. …

This week I have been solving a lot of algorithms questions on binarysearch.com as usual. I found this one problem is easy, if only you truly understand the problem first and not over complicated. Anyway, *here* is the question:

About