## Travelling Salesman Problem | Greedy Approach

Given a 2D matrix tsp[][], where each row has the array of distances from that indexed city to all the other cities and -1 denotes… Read More »

- Travelling Salesman Problem | Greedy Approach
- Split N powers of 2 into two subsets such that their difference of sum is minimum
- Make the intervals non-overlapping by assigning them to two different processors
- Find minimum moves to bring all elements in one cell of a matrix
- Maximize number of elements from Array with sum at most K
- Min steps to empty an Array by removing a pair each time with sum at most K

Given a 2D matrix tsp[][], where each row has the array of distances from that indexed city to all the other cities and -1 denotes… Read More »

Given an array A[] of N integers and an integer K, the task is to select maximum number of elements from the array whose sum… Read More »

Given a matrix mat[][], pair of indices X and Y, the task is to find the number of moves to bring all the non-zero elements… Read More »

Given an array arr[] and a target value K. The task is to find the minimum number of steps required to take all elements from… Read More »

Given a list of intervals interval[] where each interval contains two integers L and R, the task is to assign intervals to two different processors… Read More »

Given an even number N, the task is to split all N powers of 2 into two sets such that the difference of their sum… Read More »

Given N rods of different lengths. The task is to cut all the rods with some maximum integer height ‘h’ such that sum of cut-off… Read More »

Given an array of positive integers containing the price of stocks and transaction fee, the task is to find the maximum profit and the difference… Read More »

Given an array of positive integers. The task is to choose a pair of elements from the given array such that they represent the length… Read More »

Given an array of N numbers, the task is to find the maximum sum that can be obtained by adding numbers with the same number… Read More »

Given an array containing N integers. The task is to find the sum of the elements of the contiguous subarray having the smallest(minimum) sum. Examples:… Read More »

Given two arrays of size N, and two numbers X and Y, the task is to maximize the sum by considering the below points: Pick… Read More »

You are given 3 stacks, A(Input Stack), B(Auxiliary Stack) and C(Output Stack). Initially stack A contains numbers from 1 to N, you need to transfer… Read More »

In the previous post, top 10 algorithms/questions on different topics that are most asked in interviews is discussed. In this post, top 10 problems on… Read More »

Given N questions in a test and K students in the class. Out of the batch of K students, N students memorised exactly one question… Read More »