Skip to content

mkbalani/Java-Practise-Codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Java-Practise-Codes

Java Codes-Algorithms Based

  1. Code:Knapsack.java Problem Statement: Given a list of n integers, A={a1,a2,…,an}, and other interger, k representing the expected sum. Select zero or more numbers form A such that the sum of these numbers is as near as possible , but not exceeding to the expected sum(k). Note a. Each element of A can be selected multiple times. b. If no element is selected then sum is 0.

Constraints 1≤T≤10 1≤n≤2000 1≤k≤2000 1≤ai≤2000,where ibelong to set [1,n]

For example input array: 1 6 9, Expected sum=12 Optimum Value=12 input array 3 4 4 4 8, Expected sum = 9 Optimum value =9

Question @ https://www.hackerrank.com/challenges/unbounded-knapsack

About

Java Codes-Algorithms Based

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages