## Maximize the sum of arr[i]*i

Given an array of N integers. You are allowed to rearrange the element of the array. The task is to find the maximum value of… Read More »

- Split the given array into K sub-arrays such that maximum sum of all sub arrays is minimum
- Find maximum meetings in one room
- Greedy approach vs Dynamic programming
- Largest substring with same Characters
- Find minimum changes required in an array for it to contain k distinct elements
- Maximum Length Chain of Pairs | Set-2
- Unbounded Fractional Knapsack
- Check whether a subsequence exists with sum equal to k if arr[i]> 2*arr[i-1]
- Count of integers that divide all the elements of the given array
- Create a Sorted Array Using Binary Search
- Find minimum length sub-array which has given sub-sequence in it
- Count common elements in two arrays containing multiples of N and M
- Maximum distance between two unequal elements
- Maximum String Partition
- Minimum deletions required to make GCD of the array equal to 1
- Minimum operations required to make every element greater than or equal to K
- Number of balanced parenthesis substrings
- Find the Kth smallest element in the sorted generated array
- Minimum deletions required such that any number X will occur exactly X times
- Longest Subarray having strictly positive XOR
- Maximum possible sub-array sum after at most X swaps
- Count ways to divide circle using N non-intersecting chord | Set-2
- Fractional Knapsack Queries
- Find if a binary matrix exists with given row and column sums
- Minimum deletions required to make frequency of each letter unique
- Lexicographically smallest string of length N and sum K
- Length of longest sub-array with maximum arithmetic mean.
- Minimum increment operations to make K elements equal
- Find Nth smallest number that is divisible by 100 exactly K times
- Queries for number of distinct elements from a given index till last index in an array

Given an array of N integers. You are allowed to rearrange the element of the array. The task is to find the maximum value of… Read More »

Given a string S and an integer K. The task is to find lexicographically largest subsequence of S, say T, such that every character in… Read More »

Given an array of size n that has the following specifications: Each element in the array contains either a policeman or a thief. Each policeman… Read More »

You are given a lock which is made up of n-different circular rings and each ring has 0-9 digit printed serially on it. Initially all… Read More »

A greedy algorithm selects a candidate greedily (local optimum) and adds it to the current solution provided that it doesn’t corrupt the feasibility. If the… Read More »

We are given N jobs, and their starting and ending times. We can do two jobs simultaneously at a particular moment. If one job ends… Read More »

In a stock market, there is a product with its infinite stocks. The stock prices are given for N days, where arr[i] denotes the price… Read More »

Prerequisite: Partition allocation methods What is Next Fit ? Next fit is a modified version of ‘first fit’. It begins as the first fit to… Read More »

Given n tasks with arrival time, priority and number of time units they need. We need to schedule these tasks on a single resource. The… Read More »

You are given a string of 2N characters consisting of N ‘[‘ brackets and N ‘]’ brackets. A string is considered balanced if it can… Read More »

In previous post, we have discussed Set 1 of SJF i.e. non-preemptive. In this post we will discuss the preemptive version of SJF known as… Read More »

Given length of wall w and shelves of two lengths m and n, find the number of each type of shelf to be used and… Read More »

Prerequisite : Page Replacement Algorithms In operating systems that use paging for memory management, page replacement algorithm are needed to decide which page needed to… Read More »

Prerequisite: Page Replacement Algorithms In operating systems that use paging for memory management, page replacement algorithm are needed to decide which page needed to be… Read More »

We have discussed Huffman Encoding in a previous post. In this post decoding is discussed. Examples: Input Data : AAAAAABCCCCCCDDEEEEE Frequencies : A: 6, B:… Read More »