newszine

Find Bottom Left Tree Value | Tree Problem | LeetCode 513

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, write a program to find out the leftmost value in the last row of the tree. Example  Leftmost value in the last row of first binary tree is 2 and of second binary tree is 6. Breadth First Search In Breadth First Traversal, the tree is traversed Read More

Binary Tree Right Side View | Tree Problem | LeetCode 199

4 years ago Lalit Bhagtani 0
Problem Statement Imagine you are standing on the right side of a binary tree, Write a program to return the values of all the nodes that you can see ordered from top to bottom. Example  The right side view of above binary tree shows nodes.  Breadth First Search In Breadth First Read More

Minimum Depth of Binary Tree | Tree Problem | LeetCode 111

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, write a program to find out its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node of the binary tree to its nearest leaf node. Example  In above binary tree, the shortest path from root node to its Read More

Insert into a Binary Search Tree | Tree Problem | LeetCode 701

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary search tree and a value V, insert the value V into the binary search tree and return the root node of the modified BST. It is guaranteed that the value V does not exist in the BST. Example  Inserting 7 into above binary search tree. Solution To solve Read More

Search Insert Position | Search Problem | LeetCode 35

4 years ago Lalit Bhagtani 0
Problem Statement You have given a sorted array and a target value, write a program to search the target value in the sorted array. If the target value is found, then return its index otherwise return the index where it would be present if it is inserted in the sorted array. Note: Array contains no Read More

Max Consecutive Ones | Array Problem | LeetCode 485

4 years ago Lalit Bhagtani 0
Problem Statement You have given an integer array comprising of 1 and 0 integers only, write a program to find out the maximum number of consecutive 1’s in the given array. Example  Input :- Output :- 3 Input :- Output :- Read More

Design PriorityQueue using Binary Heap | Java with Generics

4 years ago Lalit Bhagtani 0
Problem Statement Design a Minimum/Maximum PriorityQueue data structure using Binary Heap data structure. The Queue data structure will supports the following operations: enqueue(N) :- It insert element N to the back of the queue. dequeue() :- It removes and returns the maximum/minimum element of the queue. peek() :- It returns (not remove) the maximum/minimum element Read More