CT31213

The Checker Stretch of the Obsidian panels

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The log keeper Jarl has been asked to fulfill a tricky customer order. On the desk lies a long table of panels readings. 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 <= 1313; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 811 567342685 982065408 381906303 456480487 341680610 902464887 175873812 258696546 251442839 401953287 499467727 393938716 693712469 65929129 98592059 725275316 355329557 968445274 345128522 506964978 734949130 124817103 815078872 6464276 399247679 629943837 665012499 274355401 772513674 283901438 358093512 575477483 34366513 727954773 914334544 516332133 734512733 681686518 173282423 66234909 501957848 708819534 865328922 368329054 922277812 309915505 128250874 762433477 219853333 229241154 920222096 132252747 276837877 927192922 107360707 437783643 76910799 605311546 675454622 701825487 565601246 606673331 799565038 173881964 75532876 27767607 514318327 578452091 938994290 427770058 950491723 269977695 611380757 973509947 600128917 56150307 918341096 909160666 759175495 366221650 307542…
Output: 8

Example 2:

Input: 1229 471588032 900819582 711994616 745280713 689317002 406066453 301091576 972870129 77614538 695664409 523836141 24334219 76693070 712268137 89933249 762891768 348587500 713307730 778065510 806903972 284092011 696108274 125020846 79775677 98995844 188026818 984426477 458032657 438119421 391596104 993209373 494715015 938742987 742332097 929907111 502182215 55916746 126509455 280617012 471751451 330183582 332985063 673257940 449360122 444649240 493023311 474410986 88745809 878217785 263656446 448041600 427142983 171285642 243864026 579601834 305551305 221788087 630396813 220295831 231613128 382387101 960611944 618765555 169548000 278448226 966925902 633103291 292467482 449446655 27869349 311922921 909606828 185656210 787392237 120263718 628820584 374811422 899075912 243016307 266789224 2268…
Output: 9

Example 3:

Input: 344 571209637 323980210 317275884 252287857 284959315 -638724 680632480 468117792 407118072 493982472 394595531 62617158 404688279 358194870 413431880 899806175 727305066 649307643 286785764 272788188 701948340 905873860 659864923 34917996 305033324 828911080 273930839 24267475 942288049 570555380 561326440 307034739 817023190 183902889 539078612 114196005 397933815 130848928 893773858 550350362 725409079 123600245 944579824 587744946 610852075 285345823 10488777 269840712 461483828 640582791 331523210 49960918 374828693 183122799 337859460 341063691 999667804 52810787 336977595 321769601 425290613 936242157 412015661 940948577 337797873 871039361 624314426 19991722 798544796 816266487 128534947 712296023 354761929 139320601 369509434 985740462 437831650 102467293 465249242 495778305 31315…
Output: 11

Constraints:

1 <= n <= 1313; -1000000 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
The Checker Stretch of the Obsidian panels - MEDIUM Coding Problem | CodeTikki