Answered step by step
Verified Expert Solution
Question
1 Approved Answer
INSTRUCTIONS Description Submissions HARD In Progress Hard You are given two lists of integers, M and N , and an integer B . Your task
INSTRUCTIONS
Description
Submissions
HARD
In Progress
Hard
You are given two lists of integers, and and an integer
B Your task is to:
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.
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
Description
Submissions
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
The given integer B 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
After removing the numbers in list from list the remaining numbers are
The given 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