Skip to content

Instantly share code, notes, and snippets.

View Svastikkka's full-sized avatar
🏛️
Working in Bengaluru

Manshu Sharma Svastikkka

🏛️
Working in Bengaluru
View GitHub Profile
## Read input as specified in the question.
## Print output as specified in the question.
class Node:
def __init__(self,data):
self.data=data
self.next=None
def LinkedLists(arr):
head=None
class Node:
def __init__(self,data):
self.data=data
self.next=None
def LinkedLists(arr):
head=None
tail=None
if len(arr)<1:
return -1
## Read input as specified in the question.
## Print output as specified in the question.
n=int(input())
arr=sorted(list(map(int,input().split())))
for i in range(len(arr)):
print(arr[i],end=" ")
## Read input as specified in the question.
## Print output as specified in the question.
n=int(input())
arr=list(map(int,input().split()))
res=set(arr)
[print(i,end=" ") for i in range(1,n+1) if i not in res]
arr=list(map(int,input().split()))
res=set(arr[1:])
[print(i,end=" ") for i in range(1,arr[0]+1) if i not in res]
class Node:
def __init__(self,data):
self.data=data
self.next=None
def LinkedLists(arr):
head=None
tail=None
if len(arr)<1:
return -1
else:
def equilibrium(arr):
total_sum = sum(arr)
leftsum = 0
for i, num in enumerate(arr):
total_sum -= num
if leftsum == total_sum:
return i
leftsum += num
return -1
n=int(input())
class Node:
def __init__(self,data):
self.data=data
self.next=None
def LinkedLists(arr):
head=None
tail=None
for i in arr:
if i==-1:
break
class Node:
def __init__(self,data):
self.data=data
self.next=None
def LinkedLists(arr):
head=None
tail=None
for i in arr:
if i== -1:
break
class Node:
def __init__(self,data):
self.data=data
self.next=None
class LinkedList:
def __init__(self):
self.head=None
self.tail=None
def inputLL(self,arr):