An element is called a peak element if its value is not smaller than the value of its adjacent elements(if they exists).
Given an array arr[] of size N, find the index of any one of its peak elements.
Note: The generated output will always be 1 if the index that you return is correct. Otherwise output will be 0.
Given a binary matrix M of size n X m. Find the maximum area of a rectangle formed only of 1s in the given matrix.
Given a value V and array coins[] of size M, the task is to make the change for V cents, given that you have an infinite supply of each of coins{coins1, coins2, …, coinsm} valued coins. Find the minimum number of coins to make the change. If not possible to make change then return -1.
Given an array Arr of N positive integers, find K largest elements from the array. The output elements should be printed in decreasing order.
Implement the next permutation, which rearranges the list of numbers into Lexicographically next greater permutation of list of numbers. If such arrangement is not possible, it must be rearranged to the lowest possible order i.e. sorted in an ascending order. You are given an list of numbers arr[ ] of size N.
Given a number K and string str of digits denoting a positive integer, build the largest number possible by performing swap operations on the digits of str at most K times.
Length of the longest substring
Given a string S, find the length of the longest substring without repeating characters.
Given a grid of size n*m (n is number of rows and m is number of columns grid has) consisting of ‘0’s(Water) and ‘1’s(Land). Find the number of islands.
Note: An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically or diagonally i.e., in all 8 directions.
Lowest Common Ancestor in a Binary Tree
Given a Binary Tree with all unique values and two nodes value, n1 and n2. The task is to find the lowest common ancestor of the given two nodes. We may assume that either both n1 and n2 are present in the tree or none of them are present.