Chocolate distribution

Read more →

Rearrange characters in a string such that no two adjacent are same

Read more →

Given a sequence of words, print all anagrams together

Read more →

Activity selection

Read more →

Job sequencing

Read more →

Huffman coding

Read more →

Water connection

Read more →

Fractional knapsack

https://practice.geeksforgeeks.org/problems/fractional-knapsack/0 class Solution { public: double fractionalKnapsack(int W, Item arr[], int n) { sort(arr, arr + n, [](const Item &a, const Item &b) { return ((double)a.value / a.weight) > (double)b.value / b.weight; }); int currWeight = 0; double cost = 0; for (int i = 0; i < n; i++) { if (arr[i].weight + currWeight <= W) { currWeight += arr[i].weight; cost += arr[i].value; } else { cost += (arr[i].value / (double)arr[i].
Read more →

Find minimum number of coins

https://practice.geeksforgeeks.org/problems/coin-piles/0 class Solution { public: int coinChange(vector<int> &coins, int amount) { int n = coins.size(); int dp[n + 1][amount + 1]; for (int i = 0; i <= n; i++) { for (int j = 0; j <= amount; j++) { if (j == 0) { dp[i][j] = 0; } if (i == 0) { dp[i][j] = INT_MAX - 1; } } } dp[0][0] = 0; for (int i = 1; i <= n; i++) for (int j = 1; j <= amount; j++) { if (coins[i - 1] <= j) { dp[i][j] = min(dp[i - 1][j], 1 + dp[i][j - coins[i - 1]]); } else { dp[i][j] = dp[i - 1][j]; } } return dp[n][amount] == INT_MAX - 1 ?
Read more →

Maximum trains for which stoppage can be provided

Read more →

Minimum platforms

Read more →

Buy maximum stocks if I stocks can be bought on Ith day

Read more →

Find the minimum and maximum amount to buy all N candies

Read more →

Minimum cost to cut a board into squares

Read more →

Check if it is possible to survive on island

Read more →

Find maximum meetings in one room

Read more →

Maximum product subset of an array

Read more →

Maximize array sum after K negations

Read more →

Maximize the sum of arr[i]*i

Read more →

Maximum sum of absolute difference of an array

Read more →

Maximize sum of consecutive differences in a circular array

Read more →

Minimum sum of absolute difference of pairs of two arrays

Read more →

Shortest Job First (SJF) CPU scheduling

Read more →

Least Recently Used (LRU) page replacement algorithm

Read more →

Smallest subset with sum greater than all other elements

Read more →

Defense of a kingdom

Read more →

Die hard

Read more →

Wine trading in Gergovia

Read more →

Picking up chicks

Read more →

Chocolate

Read more →

Arranging amplifiers

Read more →

K centers

Read more →

Find smallest number with given number of digits and sum of digits

Read more →

Find maximum sum possible equal sum of three stacks

Read more →

Connect N ropes with minimum cost

Read more →

Minimise the cashflow in a set of friends

Read more →