Data Structures & Algorithms

Count the Number of Set Bits for Every Number from 0 to n

Given a number n, count the number of 1's in the binary representation of each number from 0 to n.

Read

Check if Duplicate Element Exists in an Array

Given an array of integers, check if the array contains any duplicates.

Read

Print Matrix in Spiral Order

Given a matrix, print all elements in spiral order.

Read

Find all the Pairs with Given Sum

Given a list of integers, find all pairs with given sum.

Read

Find Combinations of a List Whose Sum is Equal to a Target

Given a list of distinct integers, find all the possible combinations which sums up to a target.

Read

Generate Spiral Matrix

Given a positive integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order.

Read

Minimum Remove to Make Valid Parentheses

Given a string, remove minimum number of parentheses to make it balanced.

Read

Check if a Binary Tree is Balanced or Not

Given root of a binary tree, check if it is balanced or not.

Read