The solution do not allow duplicate triplets, we can sort the input array, so the duplicated values will be next to each other, it will be easy for us to skip the duplicate ones.

`input array: nums = [-1,0,1,2,-1,-4]`

sort input array: nums = [-4,-1,-1,0,1,2]

We will iterate through the…

Encapsulation, abstraction, inheritance and polymorphism. Those are four primary Java OOP concepts. Understanding them can help us understand better how Java works. Those words can be intimidating we you first saw them, but it is not difficult to understand once we see some examples.

Encapsulation is binding variables and methods…

— brute force, dynamic programming, two pointers

Java collection framework provides stack and queue classes. However, in Javascript we do not have stacks and queues provided for us. In this blog, we are going to implement stacks and queues in two ways: using arrays and linked lists.

“Stack is a linear data structure which follows a particular…

The time complexity is the runtime of the code, and it is expressed by big O notation. Big O notation means we only look at the highest exponent…

There are a lot of videos talking about this Longest Palindrome Substring question, but there are still some details that took me awhile to figure it out. I broke it down a little so we can understand the approach better. I also included some explanations on the calculations.

Starting from…

Before we get into null and undefined, we should learn two concepts: javascript primitive values and falsy values. They will help us understand null and undefined, since both `null`

and `undefined`

are JavaScript’s primitive values and are treated as falsy (not false) for boolean operations ( “AND”, “OR” and “NOT”).

…

People always got confused about how to use var, let and const when declare a variable, especially for Javascript beginners. Today we are going to talk about their differences from various perspectives:

**Var can be used for declaring globally scoped variable and function scoped variable.**

`var a = 1`

function example(){…