Professional Documents
Culture Documents
GFG
GFG
org/problems/remove-character/0
t=int(input())
while t>0:
s1=input()
s2=input()
for i in s2:
if i in s1:
s1=s1.replace(i,'')
print(s1)
t=t-1
t = int(input())
while t > 0:
sum1=0
sum2=0
n= int(input())
l1=input().split()
length = len(l1)
length1=length//2
for i in range(length1):
sum1=sum1+int(l1[i])
for i in range(length1,length):
sum2=sum2+int(l1[i])
t=t-1
Max value after M range operations ->https://practice.geeksforgeeks.org/problems/max-value-after-m-
range-operation/0
**** https://practice.geeksforgeeks.org/problems/majority-element/0/?ref=self
Single iteration :
for t in range(T):
n = int(input())
K = int(input())
i=0
j = n-1
f=0
while(i!=j):
val = A[i]+A[j]
if(val == K):
f=1
print(A[i], A[j], K)
i += 1
j -= 1
else:
i += 1
if(f==0):
print(-1)
OCCURANCE OF X IN BETWEEN A AND B:
t = int(input())
while t>0:
x=input()
counts=0
l=input().split()
for i in range(int(l[0])+1,int(l[1])):
counts=counts+(str(i).count(x))
print(counts)
t=t-1
OR
count = 0
count += str(x).count(str(digit))
print(count)
t =int(input())
while t>0:
x=input()
y=bin(int(x)).replace("0b","")
y=y.zfill(32)
l1=[]
for i in reversed(y):
l1.append(i)
y1=''.join(l1)
print(int(y1,2))
t=t-1
https://practice.geeksforgeeks.org/problems/swap-all-odd-and-even-bits/0/?ref=self
arr = list(map(int,input().split()))
while t>0:
n=int(input())
l=input().split()
i=0
j=int(len(l)-1)
k=int(input())
flag=0
while i<j:
sum=int(l[i])+int(l[j])
if sum==k:
print(l[i],l[j],k)
i=i+1
j=j-1
flag=1
elif sum<k:
i=i+1
else:
j=j-1
if flag==0:
print("-1")
t=t-1