CT30480

The Checker Stretch of the Bronze stretches

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The harbor bell rings at the mangrove channels of Rootwater; Tanner weighs the day's stretches 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 <= 1707; 0 <= a[i] <= 1000000000.

Example 1:

Input: 591 360583172 942390731 551229523 845387809 63745922 449890792 110065502 985404071 812640491 896359034 155618302 681608981 174424434 816674549 736218303 90742887 763413427 744045331 859651942 118409559 263830595 806721892 302552032 429639736 785445064 353377826 503433187 505802291 193261966 59311719 92757761 794487584 790622410 45488136 224645374 345302764 541820663 183778610 168103218 814801424 501968776 794601882 240674033 34121684 968669408 117372024 491654158 733001311 655307041 235125440 533569283 938952409 74741832 544600763 370858924 133881719 237216793 841468005 293415541 732630243 170641928 68206171 857259005 914415759 854598870 304048446 476275796 719365629 778642230 135868154 302086136 712749953 787607157 276560049 140623993 270294910 789306936 731257173 698700806 975171954 9817…
Output: 9

Example 2:

Input: 842 906632945 278768314 120454409 598906732 759057232 631572205 458781032 221002171 875220490 271295314 76572910 577974232 116228495 191737599 530632032 788410880 59438512 548211389 378479407 361763317 311399092 521329001 865821905 235695559 750417022 625440492 183887888 61589523 4027105 854563426 510735219 96891950 968558654 780149896 302292461 308169708 968529335 178409043 659664263 603682312 666450380 564594674 719269376 306324718 310721353 587191398 338387858 536416235 793931477 858567580 101822804 942602296 313885800 958609394 718661729 243989358 815076039 430608188 121903485 57896945 128407388 330840557 419987564 10090122 991049978 285096443 91054756 985676788 440742315 154215991 441800440 782202729 427566963 898992785 861654438 730652872 694698522 948556206 714160910 605692515 69591…
Output: 8

Example 3:

Input: 128 655833757 905167901 636163091 621021506 993237563 980039610 287107465 941407334 978813053 15842269 727293709 857926896 238147188 186664400 263397569 289880112 189367635 84468186 980776274 649364778 23441525 299398840 813042913 544531120 630960855 739111016 259899915 20152193 724167671 331079453 445536774 380069527 586873537 754594058 871675668 238438785 180037974 982265042 699598388 193069287 234963192 230354930 978881571 514051993 18112570 783901573 385377880 430879280 175820989 697516360 350602379 230758782 748350919 361644427 212396956 158653099 767662996 614775632 498444288 52652754 563099002 325841083 632615739 309681892 431466013 566526776 56204481 78765586 3519214 229014047 486032287 427266320 662254941 580888856 436249339 40526763 429851478 284291418 921945422 510896273 2562350…
Output: 8

Constraints:

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

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