Question: input 1) 2 3 2 output1) 2 input2) 10 4 2 3 5 8 1 6 5 4 9 output 2) 8 please do in

 input 1) 2 3 2 output1) 2 input2) 10 4 2

input 1) 2 3 2

output1) 2

input2) 10 4 2 3 5 8 1 6 5 4 9

output 2) 8

please do in 10 minutes in java codes.

DQ-1 Report Error Single File Programming Question Marks : 20 Negative Marks : 0 Michael is celebrating his 10th birthday and he wished to arrange a party to all his class mates. But there are n tough guys amongst his class who are weird. They thought that this is the best occasion for testing their friendship with him. They put up conditions before Michael that they will break the friendship unless he gives them a grand party on their chosen day. Formally, ith friend will break his friendship if he does not receive a grand party on dith day. Michael is not a lavish spender and can give at most one grand party daily. Also, he wants to invite only one person in a party. So he just wonders what the maximum number of friendships he can save. Please help Michael in this difficult task. Input format First line will contain a single integer denoting n. Assume that the maximum value for n as 50. Second line will contain n space separated integers where ith integer corresponds to the day dith as given in the problem. Output format Print a single line corresponding to the maximum number of friendships Michael can save. Sample testcases Input 1 Output 1

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!