There is something wrong with this testcase 586 g t t g P 593848644 t p t t t t


#1

There is something wrong with this testcase

586 g t t g P 593848644 t p t t t t p P 680232627 P 383101258 P 240914318 g t t g g g p t P 213391515 p g p P 742850435 t t p P 140398572 t p P 223343895 g p P 781329724 p g P 957992928 g t p t g t p t t P 285167635 g g g g P 406164147 t P 758145620 p p p P 124285491 P 562495437 g t p P 944055491 p t P 52710853 p t P 300724037 t g t p p P 261181367 p t p t p g p P 878174480 g P 212362489 p p g p t p g t t t g t p p P 31729170 P 114379646 p g g g t t t g P 940773816 t t t t t p g t g t P 951862306 g P 881407410 P 353039583 P 878631052 t p p g g t P 463882617 p t g p t P 471748835 g p g g t g g t t g g g P 842420509 P 945537631 p g p p p t t t g p p P 731260864 p P 32317538 g g t t P 32484018 t t p g p P 804019134 t P 711633790 p P 800701823 g p p t P 407672563 p t g P 224962756 g g p p g P 574232670 t p p p t P 701785843 g P 444445859 g P 47850275 p t g P 501076238 g t t t g p g t p p t g p g P 309787254 t P 869566183 P 71770367 p t P 464272346 g g p P 397900315 g t t p p p g t t P 937096341 p P 436863539 t t P 542632465 P 781555871 p p t p P 254349373 P 178643603 g g P 178735710 P 52131937 g P 952629390 p P 350915931 g P 228975548 P 263688213 t p t g t P 676902702 t t P 63194601 g g P 19217890 P 596393544 p g t p t g p g P 508824208 P 36903639 p t p P 719030567 t p P 719389474 P 479824726 p p t p p g t P 725153581 P 541171427 P 103507999 p P 277436428 g t p t g t t t P 701795326 t t p t p p g p P 324304199 p P 82265427 p g p t p g p g p p p P 525849167 P 696013291 P 753175403 p p P 870235711 t g g p g p p t p g P 974721906 P 531365097 P 501145234 t p t g g t p t P 137243011 g p P 34998402 P 447313462 p p P 603194026 t t t g t p g p g P 215762626 t P 151859662 P 409772254 p p t t g g t p p P 517631790 g t g P 359027788 p p g t t P 66861044 p p t t g t P 230291592 P 681081810 t P 462993916 p g p P 100520658 p g t P 192955504 t P 651898157 g t P 357537677 g P 764119050 P 843021351 p g P 661902663 g g P 350513129 P 818846798 P 675467354 t g g t p P 393353030 t p g g P 538842245 t t g P 464133893 p t t p g p p t t p p g g P 812231214 p g P 809370817 p P 49863929 p P 133917999 g P 98397249 p p t p g t p P 565077104 t P 500269843 P 337772871 t g P 648755277 t g g g P 945760233 g t P 195829325 t p g g g g g t p g t t P 279641729 p g p p t g t t t t p p P 623929613 t t p p t P 404667209 t t p t p t p P 360716847 t g t g p p p g P 596790133 p g p g P 997831569 t t g t g t g P 619805999 g p t p g p g t P 272317483 P 830076034 t g g t g P 962873120

Your function returned the following :
125310313 935695769 935695769 125310313 593848644 935695769 935695769 935695769 935695769 125310313 240914318 240914318 125310313 125310313 125310313 383101258 125310313 742850435 742850435 140398572 125310313 125310313 125310313 957992928 680232627 125310313 680232627 481506738 481506738 125310313 125310313 125310313 125310313 406164147 124285491 562495437 124285491 124285491 300724037 124285491 300724037 481506738 125310313 164462615 279888466 279888466 302323725 279888466 364852269 364852269 364852269 279888466 364852269 31729170 31729170 31729170 31729170 31729170 31729170 31729170 940773816 940773816 940773816 940773816 940773816 31729170 31729170 31729170 31729170 31729170 878631052 31729170 31729170 881407410 881407410 31729170 951862306 31729170 31729170 31729170 951862306 31729170 31729170 951862306 951862306 31729170 31729170 31729170 31729170 279888466 279888466 279888466 279888466 32317538 32317538 32317538 32317538 32484018 32484018 32317538 804019134 800701823 -1 -1 -1 224962756 224962756 -1 574232670 -1 701785843 444445859 444445859 444445859 444445859 501076238 501076238 501076238 444445859 444445859 444445859 -1 -1 -1 309787254 869566183 309787254 309787254 309787254 397900315 397900315 -1 -1 -1 436863539 436863539 436863539 178643603 178643603 52131937 52131937 263688213 228975548 52131937 228975548 676902702 676902702 52131937 52131937 19217890 19217890 63194601 52131937 52131937 508824208 719030567 676902702 52131937 350915931 52131937 277436428 541171427 52131937 541171427 541171427 541171427 701795326 701795326 541171427 52131937 52131937 178735710 178643603 254349373 870235711 525849167 525849167 525849167 -1 -1 501145234 531365097 531365097 531365097 531365097 974721906 137243011 603194026 603194026 603194026 603194026 603194026 974721906 -1 215762626 215762626 215762626 215762626 215762626 215762626 517631790 517631790 517631790 -1 -1 -1 -1 -1 -1 -1 681081810 230291592 230291592 230291592 192955504 192955504 651898157 192955504 192955504 192955504 192955504 675467354 192955504 192955504 675467354 393353030 192955504 192955504 538842245 538842245 192955504 538842245 538842245 192955504 661902663 661902663 192955504 192955504 192955504 133917999 357537677 192955504 651898157 565077104 337772871 192955504 648755277 192955504 192955504 192955504 192955504 945760233 195829325 192955504 192955504 192955504 192955504 192955504 945760233 192955504 648755277 648755277 192955504 500269843 192955504 500269843 500269843 500269843 500269843 623929613 623929613 230291592 404667209 404667209 230291592 -1 360716847 360716847 360716847 360716847 -1 -1 -1 997831569 997831569 997831569 997831569 997831569 997831569 997831569 6

The expected returned value :
-1 -1 -1 -1 593848644 -1 -1 -1 -1 240914318 240914318 240914318 240914318 240914318 240914318 383101258 383101258 742850435 742850435 140398572 223343895 680232627 680232627 957992928 680232627 680232627 680232627 -1 -1 285167635 285167635 285167635 285167635 406164147 124285491 562495437 124285491 124285491 300724037 124285491 300724037 -1 -1 -1 878174480 -1 -1 -1 -1 -1 -1 -1 -1 31729170 31729170 31729170 31729170 31729170 31729170 31729170 940773816 940773816 940773816 940773816 940773816 31729170 31729170 31729170 31729170 31729170 878631052 31729170 31729170 881407410 881407410 31729170 951862306 31729170 31729170 31729170 951862306 31729170 31729170 951862306 951862306 31729170 31729170 31729170 31729170 -1 -1 -1 -1 32317538 32317538 32317538 32317538 32484018 32484018 32317538 804019134 800701823 -1 -1 -1 224962756 224962756 -1 574232670 -1 701785843 444445859 444445859 444445859 444445859 501076238 501076238 501076238 444445859 444445859 444445859 -1 -1 -1 309787254 869566183 309787254 309787254 309787254 397900315 397900315 -1 -1 -1 436863539 436863539 436863539 178643603 178643603 52131937 52131937 263688213 228975548 52131937 228975548 676902702 676902702 52131937 52131937 19217890 19217890 63194601 52131937 52131937 508824208 719030567 676902702 52131937 350915931 52131937 277436428 541171427 52131937 541171427 541171427 541171427 701795326 701795326 541171427 52131937 52131937 178735710 178643603 254349373 870235711 525849167 525849167 525849167 -1 -1 501145234 531365097 531365097 531365097 531365097 974721906 137243011 603194026 603194026 603194026 603194026 603194026 974721906 -1 215762626 215762626 215762626 215762626 215762626 215762626 517631790 517631790 517631790 -1 -1 -1 -1 -1 -1 -1 681081810 230291592 230291592 230291592 192955504 192955504 651898157 192955504 192955504 192955504 192955504 675467354 192955504 192955504 675467354 393353030 192955504 192955504 538842245 538842245 192955504 538842245 538842245 192955504 661902663 661902663 192955504 192955504 192955504 133917999 357537677 192955504 651898157 565077104 337772871 192955504 648755277 192955504 192955504 192955504 192955504 945760233 195829325 192955504 192955504 192955504 192955504 192955504 945760233 192955504 648755277 648755277 192955504 500269843 192955504 500269843 500269843 500269843 500269843 623929613 623929613 230291592 404667209 404667209 230291592 -1 360716847 360716847 360716847 360716847 -1 -1 -1 997831569 997831569 997831569 997831569 997831569 997831569 997831569 619805999 997831569 -1 -1 -1 830076034 272317483 272317483 830076034 272317483

Thanks for wasting my time :confused: :confused: :confused:

And when i try this using Custom Execution , Its gives ,

-1 -1 -1 -1 593848644 -1 -1 -1 -1 240914318 240914318 240914318 240914318 240914318 240914318 383101258 383101258 742850435 742850435 140398572 223343895 680232627 680232627 957992928 680232627 680232627 680232627 -1 -1 285167635 285167635 285167635 285167635 406164147 124285491 562495437 124285491 124285491 300724037 124285491 300724037 -1 -1 -1 878174480 -1 -1 -1 -1 -1 -1 -1 -1 31729170 31729170 31729170 31729170 31729170 31729170 31729170 940773816 940773816 940773816 940773816 940773816 31729170 31729170 31729170 31729170 31729170 878631052 31729170 31729170 881407410 881407410 31729170 951862306 31729170 31729170 31729170 951862306 31729170 31729170 951862306 951862306 31729170 31729170 31729170 31729170 -1 -1 -1 -1 32317538 32317538 32317538 32317538 32484018 32484018 32317538 804019134 800701823 -1 -1 -1 224962756 224962756 -1 574232670 -1 701785843 444445859 444445859 444445859 444445859 501076238 501076238 501076238 444445859 444445859 444445859 -1 -1 -1 309787254 869566183 30


#2

Don’t really understand what issue you see with the test cases. All these test cases come with a description of what the input signifies.

Are you resetting the global variables you are using ?

As mentioned in the question, “NOTE : If you are using your own declared global variables, make sure to clear them out in the constructor.”


#3

Anshuman Singh How to clear a STL stack in c++ ?

there’s no clear function


#4

Akshay Mane Okay this reply would be considered as a spoiler but i think you should need to know that thing here is a simple lines of code which can do what you want to know " while(Stack_name.size())Stack_name.pop(); ". Happy Coing :slight_smile:


#5

Akshay Mane, hypotetical myStack.clear() is equivalent to:
stack temp;
swap(myStack, temp);


#6

I am also getting the same problem with this test case.Code is working fine in "test with custom input " but on submission it gives error.


#7

i too am facing the same problem.did anyone figure it out? please tell!


#8

I am facing same issue too.


#9

if you are coding in C make sure u reinitiallise ur global variables in init function


#10

Even the soultion approach gives by interviewbit in python fails this case. I feel we have wasted my time on this problem. Aviod if someone else is facing issue in python for this test case


#11

Hi, this is because you are not clearing the stack in the constructor.
I also faced the same issue. It got resolved as soon as I did something like:-

st = stack<long long>();


#12

For this test case, there are two things because of which this test case fails:

  1. not clearing global variables
  2. using top or pop functions on empty stack

Happy Coding :slight_smile:


#13

clear both global stack in constructor
s1 = stack();
mini=stack();


#14

I was also facing same issue. This problem is occurring due to garbage value into stack. so, To resolve this problem erase all the data already present in stack.
Here is the working code:-
https://ide.geeksforgeeks.org/Q9BQ7Qa5Yf


#15

I faced the same issue.Try to clear the stack before using in MinStack.
MinStack::MinStack() {
while(!st1.empty()){
if(st1.top() == st2.top()) st2.pop();
st1.pop();
}
}