Mark The Answer
Practice
3.5 (262 votes)
Data structures
Easy
Hiring
One Dimensional
Ready
Problem
94% Success 39253 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Our friend Monk has an exam that has quite weird rules. Each question has a difficulty level in the form of an Integer. Now, Monk can only solve the problems that have difficulty level less than X . Now the rules are-

  • Score of the student is equal to the maximum number of answers he/she has attempted without skipping a question.
  • Student is allowed to skip just "one" question that will not be counted in the continuity of the questions.

Note- Assume the student knows the solution to the problem he/she attempts and always starts the paper from first question.

Given the number of Questions, N ,the maximum difficulty level of the problem Monk can solve , X ,and the difficulty level of each question , \( A_{i} \) can you help him determine his maximum score?

Input Format
First Line contains Integer N , the number of questions and the maximum difficulty X Monk can solve.
Next line contains N integers, \(A_{i}\) denoting the difficulty level of each question.

Output Format
Maximum score Monk can achieve in the exam.

Constraints

  • \( 1 \le N \le 10^{5} \)
  • \( 1 \le X \le 10^{9} \)
  • \( 1 \le A_{i} \le 10^{9} \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
65 votes
Tags:
ArraysC++1-DData StructuresGreedy AlgorithmsBasics of Greedy AlgorithmsMath
Points:20
75 votes
Tags:
1-D ArrayArraysData StructuresEasy
Points:20
31 votes
Tags:
ArraysData Structures1-DMath