Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

using deque to make a list

python
from collections import deque
def check(d):
    while d:
        big = d.popleft() if d[0]>d[-1] else d.pop()
        if not d:
            return "Yes"
        if d[-1]>big or d[0]>big:
            return "No"
    
for i in range(int(input())):
    int(input())
    d = deque(map(int,input().split()))
    print(check(d))
Comment

PREVIOUS NEXT
Code Example
Python :: what is cls and args in python classmethod 
Python :: python keep program running after crash 
Python :: pairwiseclip arcpy 
Python :: Compute p-value 
Python :: assemblyai 
Python :: parsing date columns when reading csv 
Python :: Horizontal stacked bar chart with annotations 
Python :: python get stringvar value 
Python :: python datediff days 
Python :: pandas to_csv adds unnamed column 
Python :: sample clustering of articles using kmeans and trncatedSVD 
Python :: rich import in python 
Python :: graph node structure 
Python :: python raccourci mettre paragraphe commentaire 
Python :: connection to python debugger failed: socket closed 
Python :: subprocess readline blocking problem 
Python :: subsetting a column and giving it a value using numpy 
Python :: create empty dataframe and concat 
Python :: how to access github folder in python code using github https link 
Python :: new library in python3 
Python :: import mongodatetime flask 
Python :: tkinter radiobutton "bind_all" 
Python :: van first name van second name van last name 
Python :: adding attributes and metadata to a dataset using xarray 
Python :: apply with sf 
Python :: creer des disques en python tkinter 
Python :: micropython string to int 
Python :: zeromq pub sub example python 
Python :: str = "This article is written in {}" print (str.format("Python")) 
Python :: integer to boolean numpy 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =