CT25771

The Checker Stretch of the Shimmering ribbons

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the cedar groves of Balmcrest; Zaid weighs the day's ribbons manifests and starts the calculations. Task: Print the length of the longest contiguous run in which elements alternate even, odd, even, odd, ... Input format: First line: n. Second line: n integers. Output format: Print the maximum parity-alternating run length. Constraints: 1 <= n <= 1318; 0 <= a[i] <= 1000000000.

Example 1:

Input: 1315 976584014 444086882 456326602 132538286 77554954 488441076 800702195 468377815 284239987 833480869 796581948 330943064 959006277 135257970 550139996 853012650 136305222 446254918 160626788 296078294 682916950 899683292 416063138 265386175 736986342 857899973 11140423 273460435 894884546 710336334 731383643 198374598 609042333 576915326 919779884 550056564 622155838 6902768 526078271 933201062 41872725 233930633 659513243 380020913 409212069 594477842 185434599 822051188 979054510 213082792 137060889 409976298 398579956 269589611 963144600 393215221 335983361 841498876 643101282 606251871 77071198 650981410 971325625 816086719 98486445 855226043 428433854 703346655 445659779 115277638 309426141 653894844 317303140 89811085 288718439 369746770 103424080 989985104 192853100 741367794 369…
Output: 8

Example 2:

Input: 86 665511907 882932703 817672268 880284336 684899239 630453191 283810847 684363508 418895448 289196701 584088374 834382189 355069631 50642722 942083426 649449489 217196610 935565084 765860975 576225583 926502169 618609723 59727600 713432876 229712652 450971216 1654420 899642306 125669628 456267170 361268594 764293402 728379690 345304747 247290712 628294122 373506650 894694997 931518135 920203968 580043638 484729037 785228364 654393552 892094591 866214751 343571715 951370473 907857495 680365475 934086701 162016407 774488589 718292168 482521117 9595934 673690833 978603699 625341411 907624755 671388088 660445919 714811939 137966430 499145094 774889722 67782907 60006115 428636560 325438621 473409013 68898044 95481168 396130104 138329642 2462577 872061223 948807029 649149303 850413357 784931680…
Output: 5

Example 3:

Input: 1190 291978502 158920935 802701634 711404569 663696979 167950667 508119673 666223310 520481234 533148648 864772374 744780519 366165400 555537345 815377587 622906238 106293366 111441780 926552200 757752523 387074155 527776481 428176448 23430178 97463907 358856756 675763970 311670957 381551595 176811444 930455268 658446893 501369353 139127860 867845928 308663552 984516390 733551245 252588410 281830651 440605659 288140602 616335112 496197469 404866871 602016078 457193783 167514683 694750782 6033892 599630264 659681541 710436004 339472228 659255885 957185492 593128070 943171622 898182795 611899933 204376803 721577987 320384398 298198863 87976956 820732153 132596746 673182387 606992097 180525315 841137785 618041018 994619466 443824658 723410921 996559162 479025889 704961886 274825749 76233093 6…
Output: 11

Constraints:

1 <= n <= 1318; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
The Checker Stretch of the Shimmering ribbons - EASY Coding Problem | CodeTikki