CT23830

Ruby crates At-Most Tally

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the glass towers of Prismhaven; Librarian weighs the day's crates manifests and starts the calculations. Task: Print how many array elements are less than or equal to x. Input format: First line: n and x. Second line: n integers. Output format: Print the count of elements <= x. Constraints: 1 <= n <= 834; -1000000000 <= a[i],x <= 1000000.

Example 1:

Input: 51 -754221678 -85870455 -162271073 -481779812 -530938250 -983651723 -913053276 -650430209 -656675861 -423675628 -967856917 -764911649 -149608056 -686058681 -280909697 -426837624 -187571279 -38102015 -891035298 -642345317 -243073326 -636849855 -902511488 -618867334 -761060716 -518123766 -734377795 -834433070 -442430640 -778495175 -357674639 -679083169 -982539250 -442559914 -1952797 -880148577 -953032388 -990702423 -141309069 -184655125 -335766397 -660579426 -596726643 -873031013 -598511723 -227116163 -129786289 -911297403 -152342239 -480227865 -985913973 -821819828
Output: 17

Example 2:

Input: 8 -986658419 -716544447 -446980484 -976207058 -9602371 -692267056 -548156135 -658879851 -713659919
Output: 0

Example 3:

Input: 693 -678408691 -799844874 -151243257 -851111547 -954142548 -507206327 -412644082 -138619460 -716024456 -462972289 -636455990 -630270986 -443751095 -403442522 -888619451 -683208427 -531193402 -949170435 -797966170 -622289437 -692679475 -570037444 -559747575 -381818410 -512223499 -684979898 -282894475 -130187134 -420858790 -84953109 -999913468 -778633456 -515473332 -545421641 -875288296 -663713837 -524605020 -913871497 -775872071 -369124268 -34037806 -521960102 -733976618 -264437057 -749030418 -587957036 -693509404 -543343028 -81466378 -925519688 -975420075 -833360278 -768769399 -380349774 -793518520 -858681438 -129203407 -596765462 -696400226 -564334563 -667433835 -12034576 -69643929 -696225794 -758513497 -249356010 -733633211 -894311033 -862656623 -567642290 -198709588 -662536772 -80411109…
Output: 227

Constraints:

1 <= n <= 834; -1000000000 <= a[i],x <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Ruby crates At-Most Tally - EASY Coding Problem | CodeTikki