Category

coding-interview

72 posts

Intersection of Two Arrays-II - Leet Code Solution

Intersection of Two Arrays-II - Leet Code Solution

Problem Statement Given two arrays, write a function to compute their…

Find if Array contains Duplicate Number - Leet Code Solution

Find if Array contains Duplicate Number - Leet Code Solution

Problem Statement Given an array of integers, find if the array contains any…

Single Number - Leet Code Solution

Single Number - Leet Code Solution

Problem Statement Given a non-empty array of integers, every element appears…

Maximum Length of Subarray With Positive Product - Leet Code Solution

Maximum Length of Subarray With Positive Product - Leet Code Solution

Problem Statement Maximum Length of Subarray With Positive Product. Given an…

Rotate Array - Leet Code Solution

Rotate Array - Leet Code Solution

Problem Statement Given an array, rotate the array to the right by k steps…

Calculate Max Profit - Buy and Sell Stocks Multiple Times - Leet Code Solution

Calculate Max Profit - Buy and Sell Stocks Multiple Times - Leet Code Solution

Problem Statement Say you have an array prices for which the ith element is the…

Remove Duplicates from Sorted Array - Leet Code Solution

Remove Duplicates from Sorted Array - Leet Code Solution

Problem Statement Given a sorted array nums, remove the duplicates in-place such…

Binary Tree Data Structure

Binary Tree Data Structure

A Binary tree is a data structure which has two children nodes attached to it…

Binary Search Tree (BST) Data Structure

Binary Search Tree (BST) Data Structure

A Binary Search tree (BST) is a data structure which has two children nodes…

How to calculate First Common Ancestor of two Nodes in Binary Tree

How to calculate First Common Ancestor of two Nodes in Binary Tree

First try to understand question. Its a binary tree, not a binary search tree…

What FAANG companies expect in their interview from candidates

What FAANG companies expect in their interview from candidates

Its every software engineer’s dream to work with the big FAANG companies…

Magical usage of Bitwise operators - Get optimized solutions for many arithmatic problems

Magical usage of Bitwise operators - Get optimized solutions for many arithmatic problems

Introduction I will list some of the interesting usage of bitwise operators…

Swap Nodes Pairs in Link List - Leet Code Solution

Swap Nodes Pairs in Link List - Leet Code Solution

Problem Statement Given a linked list, swap every two adjacent nodes and return…

Three Sum - Leet Code Solution

Three Sum - Leet Code Solution

Problem Statement Given an array nums of n integers, are there elements a, b, c…

Three Sum Closest - Leet Code Solution

Three Sum Closest - Leet Code Solution

Problem Statement Given an array nums of n integers and an integer target, find…

Convert Roman to Integer number - Leet Code Solution

Convert Roman to Integer number - Leet Code Solution

Problem Statement Roman numerals are represented by seven different symbols: I…

Integer to Roman conversion - Leet Code Solution

Integer to Roman conversion - Leet Code Solution

Problem Statement Roman numerals are represented by seven different symbols: I…

Longest Common Prefix - Leet Code Solution

Longest Common Prefix - Leet Code Solution

Problem Statement Write a function to find the longest common prefix string…

Container with Most Water - Leet Code Solution

Container with Most Water - Leet Code Solution

Problem Statement Given n non-negative integers a1, a2, …, an , where each…

Check whether an integer number given is palindrome or not - Leet Code Solution

Check whether an integer number given is palindrome or not - Leet Code Solution

Problem Statement Determine whether an integer is a palindrome. An integer is a…

Remove nth Node from Last - Leet Code Solution

Remove nth Node from Last - Leet Code Solution

Problem Statement Given a linked list, remove the n-th node from the end of list…