Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Concat Sort codechef solution

# 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 :: python isin 
Python :: Kivy Python ListView Scrollview with Toggle on off 
Python :: qt setfocus 
Python :: how to give float till 5 decimal places 
Python :: what is the difference between accuracy and loss 
Python :: python str of list 
Python :: align a text python 
Python :: Convert datetime object to a String of date only in Python 
Python :: PyPip pygame 
Python :: Flatten List in Python Using NumPy flat 
Python :: #adding new str to set in python 
Python :: help() function in python 
Python :: black code formatter 
Python :: how to add value in array django 
Python :: tkinter tutorial 
Python :: error: not well-formed (invalid token) 
Python :: numpy arange float step 
Python :: python string starts with any char of list 
Python :: how to scrape data from a html page saved locally 
Python :: python write into a file 
Python :: python django query 
Python :: arrays in python 
Python :: python random choices weights 
Python :: python portfolio projects 
Python :: why wont my python input accept string inputs 
Python :: adding two strings together in python 
Python :: python type hint list of specific values 
Python :: turtle python 
Python :: python how to replace a string in a list 
Python :: Difference between append() and extend() method in Python 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =