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
Given an array (with all elements greater than 0), create a non-decreasing array by swapping 2 elements if their gcd(Greatest Common Factor) is equal to the minimum element of the array. You ...read more
Given three arrays start[], duration[], amount[] of length N. A person can make money of amount[i] working for the time period [start[i], start[i]+duration[i]] on task i. Maximum amount of money a person ...read more
Given start and end time of all the cars in a given interval, find the maximum time gap in which no car travels. The start timings are given in sorted order. Examples: ...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
Given an array with n elements, task is to calculate the difference between the sum of those elements occurring at odd indexes and those at even indexes. Note : For the above ...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
In Artificial Intelligence you will encounter this puzzle. Given below is a crypt-arithmetic problem solved. Example : SEND + MORE ------- = MONEY ------- CP + IS + FUN -------- = TRUE ...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