2023stackweekdays


Submit solution

Points: 10 (partial)
Time limit: 3.0s
Memory limit: 12M

Authors:
Problem type
Allowed languages
C++, Java, Python

Create a stack of boxes initially with all the days of a week.

Sample: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday-Order of these days can be changed.

Write a python function that accepts the stack of boxes with only values "Sunday, Saturday" and removes those boxes having the names of Week Days [Monday, Tuesday, Wednesday, Thursday, Friday] from the stack.

The removed boxes should be en-queued into a new queue and returned the Queue in this Order Monday, Tuesday, Wednesday, Thursday, Friday

The original stack should have only Sunday, Saturday(TOS) and the the order must be maintained while printing the Final Stack.

Perform case sensitive string comparison wherever necessary.


Sample Input 1:

Initial Stack:

Sunday

Wednesday

Thursday

Friday

Monday

Tuesday

Saturday

Sample Output 1:

In Stack:

Saturday

Sunday

In Queue:

Monday

Tuesday

Wednesday

Thursday

Friday



Sample Input 2:

Initial Stack:

Saturday

Friday

Thursday

Wednesday

Tuesday

Monday

Sunday

Sample Output 2:

In Stack:

Saturday

Sunday

In Queue:

Monday

Tuesday

Wednesday

Thursday

Friday



Comments

There are no comments at the moment.