Question: pLEASE CODE IN JAVA ob has gone to Mars to collect some stones. The nag he iscarrying can hold a mximum weight of M. There
pLEASE CODE IN JAVA
ob has gone to Mars to collect some stones. The nag he iscarrying can hold a mximum weight of M. There are M stones weighingfrom 1 to M in Mars. There are N stones on Mars that are similar tothe ones on Earth. Find the number of stones he can bring from Marssuch that none of them are similar to any stone on Earth. InputSpecification: input1: M, denoting the size of the bag and thenumber of different stone weights present on Mars. input2: N,denoting the number of common stones on Earth and Mars. input3: AnN element array containing the list of the weights of the commonstones. Output Specification: Your function should return themaximum unique stones that can be collected from Mars. Example 1:input1: 10 input2: 3 input3: {1, 3, 5} Output: 2.?
Step by Step Solution
3.40 Rating (150 Votes )
There are 3 Steps involved in it
Answer JAVA CODE import javautilScanner public class Solution public static void mainString args The ... View full answer
Get step-by-step solutions from verified subject matter experts
