Home
Gaurav's GitHub Page
Cancel

Balanced Tree Check (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a binary tree, find if it is height balanced or not. A tree is height balanced if difference between heights of left and right subtrees is not more than one for all nodes...

Left View of Binary Tree (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a Binary Tree, return its Left view. The left view of a Binary Tree is a set of nodes visible when the tree is visited from the Left side. If no left view is possible, re...

Check for BST (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given the root of a binary tree. Check whether it is a BST or not. Note: We are considering that BSTs can not contain duplicate Nodes. geeksforgeeks SOLUTION class Solution ...

Count Leaves in Binary Tree (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a Binary Tree of size N, You have to count leaves in it. geeksforgeeks SOLUTION This can be solved by recursively traversing the binary tree and counting its leaf node...

Minimum Cost Path (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a square grid of size N, each cell of which contains an integer cost that represents a cost to traverse through that cell, we need to find a path from the top left cell t...

Find median in a stream (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an input stream of N integers. The task is to insert these numbers into a new stream and find the median of the stream formed by each insertion of X to the new stream. g...

Huffman Decoding-1 (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a string S, implement Huffman Encoding and Decoding. geeksforgeeks SOLUTION Start with an empty string ans to store the decoded characters. Initialize another nod...

Implement Queue using Linked List (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Implement a Queue using Linked List. A Query Q is of 2 Types (i) 1 x (a query of this type means pushing ‘x’ into the queue) (ii) 2 (a query of this type means to pop an elem...

Histogram Max Rectangular Area (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars hav...

Get minimum element from stack (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You are given N operations and your task is to Implement a Stack in which you can get a minimum element in O(1) time. geeksforgeeks SOLUTION We can solve this by using a sta...