CT36618

Paige and the Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the lantern lake of Firefly Mere. Paige spreads the ledgers records across the table and picks up a sharp pencil. 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: 1706 -411181405 146348516 861332676 664932969 -578068370 -687173381 -644354486 -902066636 -219067437 -974002062 -477971333 -453813015 977040795 590864256 398632318 670638827 943594604 571321484 -175660087 -906194850 86971321 -957727756 220675060 -290605575 795032621 127869442 -892661375 -363250575 -329525197 -518421936 127171628 -338546625 362966358 -396241288 -492559269 536191238 748191734 -860714023 923405394 205921470 -770750785 -832910714 217191563 861050792 981724856 361735707 -218308275 -909798470 636894075 -422562141 -251943367 -3574587 -990061273 -527176979 -342884086 -725116062 748473981 943090498 115647765 -798180165 -597206426 -390370107 989640405 534702491 -678641787 357797367 -713598381 777453823 -741777814 901226527 749588351 -516569406 -182990912 699278574 -177110608 -277956…
Output: 146348516 861332676 977040795 977040795 -219067437 -644354486 -219067437 -219067437 977040795 -477971333 -453813015 977040795 981724856 670638827 670638827 943594604 981724856 795032621 86971321 86971321 220675060 220675060 795032621 795032621 923405394 362966358 -363250575 -329525197 127171628 127171628 362966358 362966358 536191238 536191238 536191238 748191734 923405394 923405394 981724856 217191563 217191563 217191563 861050792 981724856 989640405 636894075 636894075 636894075 748473981 -251943367 -3574587 748473981 -527176979 -342884086 748473981 748473981 943090498 989640405 989640405 -597206426 -390370107 989640405 996001817 777453823 357797367 777453823 777453823 901226527 901226527 996001817 996001817 -182990912 699278574 996001817 591671807 591671807 591671807 644813879 -17909754…

Example 2:

Input: 82 86531825 867471362 -780180275 -211348436 -212952067 -468117840 -200829513 -351869155 -341390464 357347516 274644977 71730155 -348830207 616423489 -8334411 -151612782 -946195785 -650859745 -415586306 -610687779 386193416 -875634952 -944508971 923672595 -166021046 143606932 201312649 846321606 -927611679 973954992 105577022 -535889483 -604606370 -852802365 360909313 -339313801 -225988850 -186670594 554271267 -467763355 -596109487 728713481 67506171 -49987402 758176036 -950333 907202899 -611411734 849062913 -127271175 927747718 176723262 562567454 -554330532 -519680191 -201622832 178402989 305310220 709431286 -118173493 -853764433 -704626768 -503065727 956407074 574717367 -939576626 -410952433 -443366421 -461137025 575870237 21873488 -896226374 -826684647 -455567994 122617188 -207399192 -6…
Output: 867471362 923672595 -211348436 -200829513 -200829513 -200829513 357347516 -341390464 357347516 616423489 616423489 616423489 616423489 923672595 386193416 386193416 -650859745 -415586306 386193416 386193416 923672595 923672595 923672595 973954992 143606932 201312649 846321606 973954992 973954992 -1 360909313 360909313 360909313 360909313 554271267 -225988850 -186670594 554271267 728713481 728713481 728713481 758176036 758176036 758176036 907202899 907202899 927747718 849062913 927747718 927747718 956407074 562567454 709431286 -519680191 -201622832 178402989 305310220 709431286 956407074 956407074 -704626768 -503065727 956407074 -1 575870237 -410952433 575870237 575870237 575870237 617658810 122617188 -826684647 -455567994 122617188 617658810 617658810 -413238833 617658810 -1 403238217 -1 -…

Example 3:

Input: 2224 -917591880 276458306 -233209428 150168938 670180607 405463786 -707719249 -534530658 756713939 -909873958 -310694329 134064462 -842720552 -863730459 -758097162 -29079721 762694037 440208593 492291942 666864370 365308071 -682343177 711131693 721841553 632333765 269346546 -387035491 -254243525 164695486 831869756 889127388 -793602917 220361418 -600087760 145530756 886389234 3406131 -367809518 -207945209 719805022 -720639438 -270808350 43151939 276565144 682686780 -174416393 646765052 -343932652 -869989053 950544403 -301805748 -789042338 -545696832 3909994 649324710 -180542142 166159470 309654940 -659566581 -434461142 505051503 -858733669 201377376 698873883 -428618986 -89142093 703938524 -153742859 305505772 -156499087 62927164 -892974193 -260433847 958075583 996786290 600273021 76337590…
Output: 276458306 670180607 150168938 670180607 756713939 756713939 -534530658 756713939 762694037 -310694329 134064462 762694037 -758097162 -758097162 -29079721 762694037 831869756 492291942 666864370 711131693 711131693 711131693 721841553 831869756 831869756 831869756 -254243525 164695486 831869756 889127388 950544403 220361418 886389234 145530756 886389234 950544403 719805022 -207945209 719805022 950544403 -270808350 43151939 276565144 682686780 950544403 646765052 950544403 950544403 950544403 958075583 3909994 -545696832 3909994 649324710 698873883 166159470 309654940 505051503 -434461142 505051503 698873883 201377376 698873883 703938524 -89142093 703938524 958075583 305505772 958075583 62927164 958075583 -260433847 958075583 996786290 997907582 763375901 883072293 -236519744 -236519744 -778…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Paige and the Taller Ahead - MEDIUM Coding Problem | CodeTikki