Knapsack Problem in JAVA
You must introduce values into a knapsack. With n items given with weights and values, return the maximum sum of values of the subset...
You must introduce values into a knapsack. With n items given with weights and values, return the maximum sum of values of the subset...
Imagine you have a special keyboard with the following keys: Key 1: Prints 'A' on screen Key 2: (Ctrl-A): Select screen Key 3: (Ctrl-C):...
There are n stops on a journey. The train starts from station 0 and ends the journey at station n-1. All the ticket costs are given in an...
Given a certain amount of money that we have, we want to change the money into coins. What is the minimum number of coins required to...
Given a matrix of characters, find the length of the longest path starting from a character, in such a way that the characters are...
You receive as an input a number representing sections. Each section is composed of two plots, on either side of the road. You must find...
You receive as an input a number representing sections. Each section is composed of two plots, on either side of the road. You must find...
Starting from two received variables: digits and sum, find how many numbers having that amount of digits have the required sum of their...
For a game that has the possibility for the players to score 3, 5 or 10 points, find in how many ways we can reach a certain total score....
Starting from a given length, find all the possible distinct binary strings of that length, in such a way that there are no consecutive...
You are given a limit and have to find the sum of all numbers from one to that limit. Solution: 1. static int sumOfDigitsFrom1ToN(int...
Using a grid of cells that holds values, try to find the maximum number of points that can be summed by using two traversals. The first...
You are given an integer array of coin values and an integer representing the total amount of money. Return the number of possible ways...
Given a Boolean expression with the following symbols: 'T' ---> true 'F' ---> false And the following operators filled between symbols: & ...
Write a function that accepts two parameters n and k, and returns the value of the Binomial Coefficient C(n, k). Solution: 1. static...
In a matrix you have to find the minimum cost path to reach the last cell from the first one, meaning that starting from the top left...
Having a given polygon, divide it using triangulation between all points, having the minimum cost. This means that we have to divide the...
The maximum length chain of pairs is a variation of the longest increasing subsequence problem. We have to find the pairs of numbers that...
Using this algorithm we can find the longest increasing subsequence from a given array. This means that we will find the numbers that are...
Having two strings, you have to find the longest common subsequence. This means that you have to find how many letters are found in both...