Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are given two lists of integers; M and N , and an intege B . Your task is t : Remove all numbers from
You are given two lists of integers; and and an intege
B Your task is t:
Remove all numbers from that appear in
Find the largest possible group of numbers more number of elements of should be present in the group from the updated list whose total sum is less than or equal to
Print the sum of numbers in the above group.
Note
All the integers in and are unique.
Input
The first line of input contains spaceseparated integers.
The second line of input contains spaceseparated integers.
The third line of input contains an integer B
Output
The output should be a single line containing an integer that represents the sum of the numbers in the largest possible group of numbers more number of elements from the updated list without exceeding the given integer
Exaplanation
For example, if the given spaceseparated integers are and spaceseparated integers are and the integer is
After removing the numbers that appear in list from list the remaining numbers are
For example, if the given spaceseparated integers are
and spaceseparated integers are and the integer is
After removing the numbers that appear in list from list the remaining numbers are
The given integer is
The largest group of numbers from the remaining list where sum does not exceed is Adding to would exceed
Therefore, the sum of the numbers in the largest possible group of numbers from the updated list without exceeding the given integer is
So the output should be
For example, if the given spaceseparated integers are and spaceseparated integers are and the integer is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started