Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

concat sort

# name: MD Murad Hossain
# Eamil: muradhossainm01@gmail.com
# Accepted ho ja:

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int,input().split()))[:n]
    arr_2 = sorted(arr)
    arr_3 = [arr.index(arr_2[0]),0]
    null_arr = [0]*n
    # loop:
    for i in range(2):
        arr_3[0] = 0
        # while condition:
        while arr_3[0] < n:
            # checking not same:
            if not null_arr[arr_3[0]] and arr[arr_3[0]] == arr_2[arr_3[1]]:
                null_arr[arr_3[0]] = 1
                arr_3[0] += 1
                arr_3[1] += 1
            else:
                arr_3[0] += 1
    # current check:
    if arr_3[0] == arr_3[1]:
        print("YES")
    else:
        print("NO")
# Program Finnished.
Comment

PREVIOUS NEXT
Code Example
Python :: find & replace in csv file 
Python :: python treemap example 
Python :: pyqt set focus 
Python :: dataframe look at every second column 
Python :: covariance in python 
Python :: first and last name generator python 
Python :: why are my static files not loading in django 
Python :: ip address finder script python 
Python :: head first python by paul barry pdf 
Python :: stack in python 
Python :: loop through list of lists jinja 
Python :: dataframe python 
Python :: defaultdict python dict inside dict 
Python :: python timestamp to string 
Python :: a list of keys and a list of values to a dictionary python 
Python :: Python __mul__ 
Python :: arange float step 
Python :: fillna spark dataframe 
Python :: teardown module pytest 
Python :: How to sort a Python dict by value 
Python :: how to use list in python 
Python :: print function args python 
Python :: django on delete set default 
Python :: chatterbot python 
Python :: django generate openapi schema command line 
Python :: combining strings in python 
Python :: why pytest return No ModuleError 
Python :: python catch any exception 
Python :: replace in lists py 
Python :: django queryset and operator 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =