Hey Guys Code Python Mishka Started Participating Programming Contest Nn Problems Contest Q43899695
Hey guys this code in in python
Mishka started participating in a programming contest. There arenn problems in the contest. Mishka’s problem-solving skill is equalto kk.
Mishka arranges all problems from the contest into a list.Because of his weird principles, Mishka only solves problems fromone of the ends of the list. Every time, he chooses which end (leftor right) he will solve the next problem from. Thus, each problemMishka solves is either the leftmost or the rightmost problem inthe list.
Mishka cannot solve a problem with difficulty greater than kk.When Mishka solves the problem, it disappears from the list, so thelength of the list decreases by 11. Mishka stops when he is unableto solve any problem from any end of the list.
How many problems can Mishka solve?
Input
The first line of input contains two integers nn and kk(1≤n,k≤1001≤n,k≤100) — the number of problems in the contest andMishka’s problem-solving skill.
The second line of input contains nn integersa1,a2,…,ana1,a2,…,an (1≤ai≤1001≤ai≤100), where aiai is thedifficulty of the ii-th problem. The problems are given in orderfrom the leftmost to the rightmost in the list.
Output
Print one integer — the maximum number of problems Mishka cansolve.
Examples
input
Copy
8 44 2 3 1 5 1 6 4
output
Copy
5
input
Copy
5 23 1 2 1 3
output
Copy
0
input
Copy
5 10012 34 55 43 21
output
Copy
5
Note
In the first example, Mishka can solve problems in the followingorder:[4,2,3,1,5,1,6,4]→[2,3,1,5,1,6,4]→[2,3,1,5,1,6]→[3,1,5,1,6]→[1,5,1,6]→[5,1,6][4,2,3,1,5,1,6,4]→[2,3,1,5,1,6,4]→[2,3,1,5,1,6]→[3,1,5,1,6]→[1,5,1,6]→[5,1,6],so the number of solved problems will be equal to 55.
In the second example, Mishka can’t solve any problem becausethe difficulties of problems from both ends are greater thankk.
In the third example, Mishka’s solving skill is so amazing thathe can solve all the problems.
Expert Answer
Answer to Hey guys this code in in python Mishka started participating in a programming contest. There are nn problems in the cont…
OR