We all must have encountered the vertical Traversal of the Binary Tree problem. In this version of the problem we will see how we can perform the traversal vertically while keeping in Read more →
Java Programs
25 postsGiven an array of n integers, you need to find minimum number of below operation such that arrays becomes sorted in non-decreasing order. In a single operation you can rotate the given Read more →
Given an Integer Stack in Java, sort the stack in increasing order (Ascending Order) Examples: Input : Stack: [10, 2, 16, 5, 9, 1] Peek: 1 Output : Stack: [1, 2, 5, Read more →
You are given a string s consisting only of characters ‘a’ and ‘b’. You can delete any number of characters in s to make s balanced. s is balanced if there is Read more →
Mex of an array is the smallest non-negative integer that does not appear in the array. Given an array of non-negative integers, find mex of its elements. Examples : Input : arr[] Read more →
Given an array arr of size n, the task is to sort this array using minimum swaps. We are allowed to swap only adjacent elements. Examples: Input: arr[] = {1, 4, 3, Read more →
We have n boxes in which we have to place c magnets such that minimum distance between two magnet should be maximum. As we know any two magnet become aggressive when kept Read more →
You have to paint n boards of length {L1, L2, L3,…,Ln-1}. There are k painters available and each painter takes t time to paint 1 unit of board. You have to get Read more →
Given an array arr[] of n elements, write a function to search a given element x in arr[]. Examples: Input : arr[] = {10, 20, 80, 30, 60, 50, 110, 100, 130, Read more →
Given a square matrix of n order in which two positions are filled. Fill two more positions such that a rectangle is formed by joining all points. Examples: Input: n=4 Matrix[][]= 1 Read more →