Question: Plz provide the solution asap in python or cpp . Plz it is a request Description Problem Statement You own a chocolate shop with chocolates

Plz provide the solution asap in python or cpp .Plz it is a request
Description
Problem Statement
You own a chocolate shop with chocolates priced from 1 to 109 consecutively. A student visits your shop for K consecutive days and buys chocolates indexed at (A1,A2,A3,....,An) on each day.
Formally, you are given an array 'A' representing the chocolate indexes the student buys each day. Your task is to determine the minimum-priced chocolate remaining in your shop after the Kth day.
Input format
The first line of input contains an integer N, denoting the indexes.
Next N lines contain an integer A[i] where A[1] A[2] A[3]q,K.
The next line contains an integer K, denoting the number of days.
Constraints
1N500
1A[i]109
1K105
Output format
Print the minimum-priced chocolate remaining in your shop after the Kth day.
Sample test cases
Input
5
1
2
4
5
6
1
Output
3
Explanation
1st day: 1st,2nd,4th,5th, and 6th chocolate is removed
{1,2,3,4,5,6,7,8dots........,109}.
So the chocolate set changes to {3,7,8,9,dotsdots...,109}.
Since K=1, the minimum price of chocolate left after the Kth day equals 3.
Input
 Plz provide the solution asap in python or cpp .Plz it

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!