Question: JAVA LANGUAGE Extra Credit Coding Problem Problem Write a solution for the following problem: Given a String containing n integer values, find all two-integer combinations

JAVA LANGUAGEJAVA LANGUAGE Extra Credit Coding Problem Problem Write a solution for the

Extra Credit Coding Problem Problem Write a solution for the following problem: Given a String containing n integer values, find all two-integer combinations in the candidate values list (the first n-1 values, preceding the semicolon) that sum to produce the nth value (the target value, following the semicolon). Example 1 The provided String: The "candidate" values are: The "target" sum is: The valid combinations are: "1,2,3,4:5" 1, 2, 3, and 4 1 + 4 2 + 3 Example 2 The provided String: The "candidate" values are: The "target" sum is: The valid combinations are: "2,3,5,2,6,4,4;8" 2,3, 5, 2, 6, 4, and 4 (NOTE the duplicate values) 2 + 6 3 + 5 2 + 6 (Since 2 occurs twice, it generates two solutions) 4 + 4 Example 3 The provided String: The "candidate" values are: The "target" sum is: The valid combinations are: 43,0,5;8" 3, 0, and 5 3+5 Notes on Solution 1. The input is in the form of a single String object. That object must: a. Be input by a user through the keyboard b. Be broken into two parts: the candidates and the target C. The candidate values must be separated into individual pieces d. Each individual candidate value must be converted from a string or char to an int value. e. Both the separation into candidates and target and the separation of individual candidate values may be done using methods of class String. f. Conversion of the resulting String or char value into an int value may be done using a wrapper class method. 2. It is necessary to move through the list of candidate values only once, in a single direction

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!