Improve your coding skills

stack

Flatten Binary Tree to Linked List

Given a binary tree and we need to return a flattened tree

dp

How to find the Nth Fibonacci number

You'll know how to solve the Fibonacci sequence problem

linked-list

How to detect a loop in a linked list

Given a linked list, check if it has a circle in it or not

linked-list

How to reverse a linked list

In this tutorial, you will see how to implement a reverse linked list algorithm.

stack

Valid parentheses

In this tutorial, you will see how to use the stack data structure to validate parentheses.

binary

What is Hamming distance

In this tutorial, you will learn what Hamming distance is and how to count it.

binary

Bitwise operators

In this tutorial, you will learn what bitwise operators are and how they work.

array

Find the missing number

In this article, you will know how to find the missing number.

binary

Count set bits in an integer

In this tutorial, you will learn how to count the number of set bits in an integer.

basic

How to find all palindromic substrings

In this article, you will know how to find all palindromic substrings.

basic

How to find the longest palindromic substring

This lesson will teach you how to find the longest palindromic substring.

basic

How to check if a string is a palindrome

In this tutorial, you will learn what is a palindrome and how to check if a string is a palindrome

dp

How to find longest increasing subsequence

In this lesson, you will know how to find the length of the longest increasing subsequence using dynamic programming.

dp

How to climb stairs

Given a staircase with a number of steps. Count how many distinct ways can you climb the stairs.

basic

What is an exhaustive search

In this tutorial, you will learn what is an exhaustive search, how it works, and see the real example

hash-table

Find a pair of numbers in an array with a given sum: Linear Time Complexity

You will learn how to find a pair of numbers in an array with a given sum in linear time.

sorting

Find a pair of numbers whose sum is equal to the given sum

Given an array of integers and sum, return a pair of numbers whose sum is equal to the given sum.

cache

How to Implement LRU Cache

In this tutorial, we're going to learn about the Least Recently Used (LRU) cache and look at how to implement it.

basic

Majority Element

How to find the majority element in an array

binary-tree

How to count the height of a binary tree

The height of the binary tree is the number of edges in the longest path from the root node to a leaf node.

binary-tree

How to find the minimum depth of a binary tree

How to find the minimum depth of a binary tree

binary-tree

How to find the maximum depth of a binary tree

How to find the maximum depth of a binary tree

binary-tree

How to find bottom left value in a binary tree

The naive approach, visit all nodes and compare a value in each node. A better approach is to use the definition of a binary search tree.

binary-tree

How to insert a node in a binary search tree

We have seen preorder traversal algorithm for a binary tree without recursion. In this article, we'll implement postorder traversal algorithm for a binary tree without recursion

binary-tree

How to count sum for root to leaf numbers

Given a binary tree, each node has a value from 0 to 9. Each path from a root to a leaf represents a number, return a sum of all these numbers.

array

How to rotate an array to the right by K steps

Given an array of integers and K, return a rotated array to the right by K steps

binary-tree

How to convert a sorted array to a binary search tree

Given sorted array in ascending order, return a height-balanced binary search tree

binary-tree

Binary tree postorder traversal without recursion

We have seen preorder traversal algorithm for a binary tree with recursion. In this article, we'll implement postorder traversal algorithm for a binary tree without recursion

binary-tree

Binary tree maximum path sum

Given a non empty binary tree, find out the path with a maximum sum

binary-tree

Bottom-up level order traversal of a binary tree

Given a binary tree, return the bottom-up level order traversal of a binary tree

binary-tree

Binary tree preorder traversal without recursion

We have seen inorder traversal algorithm for a binary tree without recursion. In this article, we'll implement preorder traversal algorithm for a binary tree without recursion

binary-tree

Binary tree inorder traversal without recursion

We have seen inorder traversal algorithm for a binary tree, but it was a recursive version. In this article, we'll take a look at the non-recursive approach

binary-tree

Lowest common ancestor of a binary search tree

Given a binary search tree and two nodes node1 and node2, return lowest common ancestor value

binary-tree

Path Sum In Binary Tree

Given a binary tree and a sum. Write a method to check if there's a path from a root to a leaf where a sum of nodes equals to the given sum

binary-tree

How to check if a binary tree is a binary search tree

A binary search tree (BST) is a binary tree where each node has a key and meet the following requirements

linked-list

What is a doubly linked list

A doubly linked list is a linked data structure that consists of a set of sequentially linked nodes.

binary-tree

How to find maximum value in a Binary Search Tree (BST)

The naive approach, visit all nodes and compare a value in each node. A better approach is to use the definition of a binary search tree.

binary-tree

How to find minimum value in a Binary Search Tree (BST)

The naive approach, visit all nodes and compare a value in each node. A better approach is to use the definition of a binary search tree.

binary-tree

What is a Binary Search Tree

A Binary Search Tree (BST) is a binary tree where each node has a key and meet the following requirements

basic

How to reverse a string

Reverse a string it's a very common question on an interview. During this article, you will know how to do it correctly

graph

What is Breadth First Search

The Breadth First Search (BFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node and explores all of the neighbor nodes at the present present depth before moving on to the nodes at the next depth level.

graph

Graph Data Structure

A graph is a non-linear data structure consisting of nodes and edges. Formally, a graph is a pair of sets (V, E), where V is the set of vertices and E is the set of edges, connecting the pairs of vertices.

tree

Sum of the left leaves (Interview Way)

This article aims to explain how to solve the Left Leaves Sum problem during a technical interview.

binary-tree

How to check if a binary tree is symmetric (recursive approach)

Given a binary tree. Write a method to check does the tree symmetric around the center or not

linked-list

What is a singly linked list

Singly linked list is a sequence of data structures (nodes), which are connected together through links

graph

What is Depth First Search

The Depth First Search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node and explores all the nodes by going forward if possible or uses backtracking

queue

How to build a queue (linked list implementation)

Queue is a data structure based on first in first out (FIFO) policy

tree

How to check if two binary trees are the same

Given two binary trees, write a method to check if the trees are the same or not

binary-tree

How to invert a binary tree

Given a binary tree. Write a method to invert this tree

basic

Basic data structures every software engineer must know

Data structures every software engineer must know. A data structure is a specialized way of organizing data that allows efficiently process it with associated algorithms.

tree

How to check if a binary tree is symmetric (iterative approach)

Given a binary tree. Write a method to check does the tree symmetric around the center or not

binary-tree

Merge two binary trees

Given two binary trees, return a merged tree

binary-tree

Level order traversal of a binary tree

Given a binary tree, return level order traversal

tree

How to calculate the sum of the left leaves of a binary tree

Given a binary tree. Calculate the sum of the left leaves

binary-tree

What is a binary tree

A binary tree is a hierarchical data structure

binary-tree

Binary tree traversals

Traversing a binary tree involves iterating over all nodes in some order

binary-tree

How to count a binary tree size

Given a binary tree, return binary tree size. Size of the binary tree is number of nodes in the tree.

stack

How to build a stack (Linked List implementation)

We already saw how a Stack can be implemented based on an array, now let's take a look at how we can implement the Stack using a linked list

stack

How to build a stack (array implementation)

Stack is a data structure based on last in first out (LIFO) policy

binary-tree

What is a binary search

Binary search is an efficient search algorithm that finds the position of the target value in a sorted array. Let's take a look at an example.