Problem Statement: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.



Approach-1: BFS


Initialize a queue data structure that would be useful for tree traversal and storing the…

Problem Statement: You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. …

Problem Statement: Given an undirected graph , return true if and only if it is bipartite.

A graph is bipartite if we can split its set of nodes into two independent subsets A and B such that every edge in the graph has one node in A and another node…

Problem Statement: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.

LCA is defined between two nodes p and q as the lowest node in the tree that has both p and q as descendants (where a node can be a descendant…

Problem Statement: Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference of the BST.

BST is a tree in which every node in the left subtree have value lesser than the root node…

Shivani Dwivedi

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store