Problem Description You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. There are two types of logs: Letter-logs: All words ...
Max Min (InterviewBit)
PROBLEM DESCRIPTION Given an array A of size N. You need to find the sum of Maximum and Minimum element in the given array. interviewbit SOLUTION We can break the array into two sections and se...
Partitions (InterviewBit)
PROBLEM DESCRIPTION You are given a 1D integer array B containing A integers. Count the number of ways to split all the elements of the array into 3 contiguous parts so that the sum of elements i...
Flip (InterviewBit)
PROBLEM DESCRIPTION You are given a binary string A(i.e. with characters 0 and 1) consisting of characters A1, A2, …, AN. In a single operation, you can choose two indices L and R such that 1 ≤ L ...
Maximum Area of Triangle (InterviewBit)
PROBLEM DESCRIPTION Given a character matrix of size N x M in the form of a string array A of size N where A[i] denotes ith row. Each character in the matrix consists any one of the following thr...
Maximum Absolute Difference (InterviewBit)
PROBLEM DESCRIPTION You are given an array of N integers, A1, A2 ,..., AN. Return maximum value of f(i, j) for all 1 ≤ i, j ≤ N. f(i, j) is defined as |A[i] - A[j]| + |i - j|, where |x| denotes ab...
Maximum Sum Triplet (InterviewBit)
PROBLEM DESCRIPTION Given an array A containing N integers. You need to find the maximum sum of triplet ( Ai + Aj + Ak ) such that 0 <= i < j < k < N and Ai < Aj < Ak. If no su...
Minimum Lights to Activate (InterviewBit)
PROBLEM DESCRIPTION There is a corridor in a Jail which is N units long. Given an array A of size N. The ith index of this array is 0 if the light at ith position is faulty otherwise it is 1. All...
Min Steps in Infinite Grid (Interviewbit)
PROBLEM DESCRIPTION You are in an infinite 2D grid where you can move in any of the 8 directions (we can move diagonally as well) You are given a sequence of points and the order in which you nee...
Pick from both sides (Interviewbit)
PROBLEM DESCRIPTION Given an integer array A of size N. You have to pick exactly B elements from either left or right end of the array A to get the maximum sum. Find and return this maximum possib...