CT24976

The Shelf Position Beneath Beeswick

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Tracker inherited the chandlery at the honeycomb cliffs of Beeswick along with its curious bookkeeping system for vials. Time to make sense of it. Task: The array is sorted in non-decreasing order. Print the 1-based index of the first occurrence of x, or -1 if x is absent. Input format: First line: n and x. Second line: n sorted integers. Output format: Print the 1-based index or -1. Constraints: 1 <= n <= 423; 0 <= a[i],x <= 1000.

Example 1:

Input: 24 158 27 30 31 166 262 264 278 280 282 443 460 560 638 848 871 875 882 913 924 947 947 978 979 987
Output: -1

Example 2:

Input: 47 162 15 47 119 147 153 168 172 238 246 258 266 274 294 308 358 370 370 408 423 464 481 515 538 553 571 579 597 610 618 621 659 661 698 709 710 771 812 849 874 885 886 903 905 944 946 972 980
Output: -1

Example 3:

Input: 217 696 2 2 23 25 26 30 30 44 44 48 57 59 59 63 71 77 77 78 78 80 85 85 85 89 101 104 125 144 149 158 159 166 168 169 172 174 176 178 181 183 191 197 200 202 202 203 204 215 217 218 220 224 227 228 236 237 253 257 261 261 265 266 273 274 275 277 287 288 290 290 294 301 305 314 317 319 321 324 335 337 339 339 345 346 348 349 364 365 372 376 376 384 386 390 390 399 401 422 435 437 439 442 447 451 454 477 493 499 503 509 522 530 534 540 544 546 551 552 557 560 579 583 590 597 600 602 606 608 612 612 613 617 630 633 636 640 645 652 655 656 660 662 671 686 691 696 698 702 706 711 714 715 718 718 719 725 728 733 737 738 741 754 754 761 769 776 789 797 797 801 808 812 814 816 822 825 831 844 850 852 853 854 856 867 877 889 890 895 895 904 904 907 907 915 917 921 927 935 939 942 943 949 951 961 964 966 970 973 974 983 985 988 988 991 995 998 998
Output: 146

Constraints:

1 <= n <= 423; 0 <= a[i],x <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
The Shelf Position Beneath Beeswick - EASY Coding Problem | CodeTikki