Given a binary tree, find height of it. Height of empty tree is 0 and height of below tree is 3.
Example Tree
Recommended: Please solve it on “PRACTICE ...

Share

A binary search tree (BST) is a node based binary tree data structure which has the following properties.
• The left subtree of a node contains only nodes with...

Share

Given an array (or string), the task is to reverse the array/string.
Examples :
Input : arr[] = {1, 2, 3}
Output : arr[] = {3, 2, 1}
Input : arr[] = {4, 5, 1, 2}
...

Share

Given a number n, print all primes smaller than or equal to n. It is also given that n is a small number.
Example:
Input : n =10
Output : 2 3 5 7
Input : n = 20
...

Share

We recommend reading following post as a prerequisite of this post.
K’th Smallest/Largest Element in Unsorted Array | Set 1
Given an array and a number k where...

Share

Given an array and a number k where k is smaller than size of array, we need to find the k’th smallest element in the given array. It is given that ll array ...

Share

We recommend reading following posts as a prerequisite of this post.
K’th Smallest/Largest Element in Unsorted Array | Set 1
K’th Smallest/Largest Eleme...

Share

Given a set of strings, find the longest common prefix.
Input : {“geeksforgeeks”, “geeks”, “geek”, “geezer”}
...

Share

Given an array (or string), the task is to reverse the array/string.
Examples :
Input : arr[] = {1, 2, 3}
Output : arr[] = {3, 2, 1}
Input : arr[] = {4, 5, 1, 2}
...

Share

We recommend reading following posts as a prerequisite of this post.
K’th Smallest/Largest Element in Unsorted Array | Set 1
K’th Smallest/Largest Eleme...

Share