We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Collections
- Piling Up!
- Discussions
Piling Up!
Piling Up!
Sort by
recency
|
947 Discussions
|
Please Login in order to post a comment
The description of problem statement seems a bit odd to me.
Here's a better explanation of the problem statement for future porblems solvers.
Piling Up! Problem
What Are We Trying to Do?
Your task is to decide if it is possible to build a single tower of blocks from a given row of blocks. The tower (stack) must follow these rules:
What Is the Situation?
Rules You Must Follow:
What You Have to Decide:
For each test case:
I know the expectation is to use deque to solve this. But still went ahead with a simpler approach.
test_cases = int(input()) for i in range(test_cases): ln = int(input()) blocks = list(map(int, input().split())) if max(blocks) == blocks[0] or max(blocks) == blocks[-1]: print("Yes") else: print("No")
t=int(input())
while t: