CT49201

The Taller Ahead of the Faded signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the dune sea of Caravanrest, Yash records each signals in a worn leather ledger. The guild wants answers, not guesses. Task: For each element print the value of the nearest element to its right that is strictly greater, or -1. Input format: First line: n. Second line: n integers. Output format: Print n answers space-separated. Constraints: 1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 1430 568396121 37921796 874539470 357784662 857081815 -770136607 -867609782 655726164 -623816803 360463697 728071544 -47279727 -841711844 -403281754 -709795496 509270571 663279828 -770772854 455505211 -718887028 -402905547 455170197 -740271148 -103029409 752183290 -918930869 -757848477 -141326738 997347468 -412289871 885916278 392897457 605550964 -467856207 -294095702 -622493113 901713890 -577117376 -994121637 -833773984 -121134645 -7417563 -772669418 645814806 524155651 374101666 -504669141 -814926265 800525949 545578737 59541393 -828866027 866127958 782122227 273718061 -541924839 868559937 -992418931 -493992307 -822802404 -720044932 -981904396 769106769 347052729 -705973816 -822376739 368964754 213884706 857493684 793421345 -240907733 937016741 -329599695 257269738 155172040 879882289 -1…
Output: 874539470 874539470 997347468 857081815 997347468 655726164 655726164 728071544 360463697 728071544 752183290 509270571 -403281754 509270571 509270571 663279828 752183290 455505211 752183290 -402905547 455170197 752183290 -103029409 752183290 997347468 -757848477 -141326738 997347468 999192661 885916278 901713890 605550964 901713890 -294095702 901713890 901713890 937016741 -121134645 -833773984 -121134645 -7417563 645814806 645814806 800525949 800525949 800525949 800525949 800525949 866127958 866127958 866127958 866127958 868559937 868559937 868559937 868559937 937016741 -493992307 769106769 -720044932 769106769 769106769 857493684 368964754 368964754 368964754 857493684 857493684 937016741 937016741 937016741 975094755 257269738 879882289 879882289 934285719 331389835 331389835 331389835 …

Example 2:

Input: 1906 -235431280 -273533472 194553481 -941378118 -912167566 -715952828 -261867478 795733140 309803883 192117028 -673045311 298491930 134585595 987789637 916478957 937304157 358087898 -416404904 -817855410 -941947983 798357017 534149215 959349800 -741592013 -879481513 577829576 255382757 -102324165 202757370 -875963529 -210086097 544356417 -290262607 630517761 -886157140 -496472491 -296914165 730042376 721559507 -506253658 -683811345 -653208869 -146587059 72674611 670863709 -104270853 -705926767 -46540490 -958377046 349127401 217182305 -544184115 646049183 837559571 -608072313 -632755307 -94902098 36642776 -560403432 -273996636 -367154136 421966342 -420016220 -803890119 -249083584 901932213 858017387 -706897828 786619005 -106217823 -564932297 -811204295 513685800 939078692 -93695388 58187448…
Output: 194553481 194553481 795733140 -912167566 -715952828 -261867478 795733140 987789637 987789637 298491930 298491930 987789637 987789637 992340656 937304157 959349800 798357017 798357017 798357017 798357017 959349800 959349800 972855806 577829576 577829576 630517761 544356417 202757370 544356417 -210086097 544356417 630517761 630517761 730042376 -496472491 -296914165 730042376 837559571 837559571 -146587059 -653208869 -146587059 72674611 670863709 837559571 -46540490 -46540490 349127401 349127401 646049183 646049183 646049183 837559571 901932213 -94902098 -94902098 36642776 421966342 -273996636 421966342 421966342 901932213 -249083584 -249083584 901932213 939078692 939078692 786619005 939078692 513685800 513685800 513685800 939078692 972855806 581874483 910677369 -570624724 228315435 910677369…

Example 3:

Input: 3789 -926248536 -909180524 -846568124 584963824 -757178185 -348602853 -792226484 -37894466 515820786 905655651 836056792 360482536 331048610 -900146988 161221699 -398407920 -561926904 372719571 -375296461 163711078 -656001001 987985544 599715881 928448609 -36192906 -693570008 -223647943 340194476 947091190 806801957 355620084 448976125 -941133905 158044322 -330186878 -864604803 -895688267 392314792 -541992924 -19902516 832166792 -89992168 -614996752 -177221037 -853102703 210736956 435003540 860742689 10335687 312485462 789156364 832082548 -746698068 -280809541 -965101291 805553816 -413018088 -479787564 171582679 -777130039 533770678 455788615 701085697 130152040 485974590 372449034 407171000 -465831231 -91022059 -950974100 -441973746 -44667467 159549781 763976181 -446288989 267426094 -5426…
Output: -909180524 -846568124 584963824 905655651 -348602853 -37894466 -37894466 515820786 905655651 987985544 987985544 372719571 372719571 161221699 372719571 372719571 372719571 987985544 163711078 987985544 987985544 989227541 928448609 947091190 340194476 -223647943 340194476 947091190 986320439 832166792 448976125 832166792 158044322 392314792 392314792 392314792 392314792 832166792 -19902516 832166792 860742689 210736956 -177221037 210736956 210736956 435003540 860742689 986320439 312485462 789156364 832082548 986320439 -280809541 805553816 805553816 986320439 171582679 171582679 533770678 533770678 701085697 701085697 763976181 485974590 763976181 407171000 763976181 -91022059 -44667467 -441973746 -44667467 159549781 763976181 986320439 267426094 588885892 -163286592 588885892 745499852 12…

Constraints:

1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

Loading...
Test Cases:No test cases
No test cases available.
The Taller Ahead of the Faded signals - MEDIUM Coding Problem | CodeTikki