21. Problem 21 - Smallest Window Containing All Characters (Any Order)
Required Input:
this is a test string
tistExpected Output:
t stri
Code In Python
def smallest_window(s1, s2):
# Write your logic here
pass
# Prefilled input
s1 = "this is a test string"
s2 = "tist"
print(smallest_window(s1, s2))
Run Code?
Click Run Button to view compiled output
22. Problem 22 – Frequency of Elements in an Array
Required Input:
[1, 2, 2, 1, 3]
Expected Output:
1 2
2 2
3 1
Code In Python
def element_frequency(arr):
# Write your logic here
pass
Run Code?
Click Run Button to view compiled output
23. Problem 23 – Check if Two Arrays Are Equal (Using Hashing)
Required Input:
Array 1: [1, 2, 3, 4]
Array 2: [4, 3, 2, 1]
Expected Output:
True
Code In Python
def are_arrays_equal(arr1, arr2):
# Write your logic here
pass
Run Code?
Click Run Button to view compiled output
24. Problem 24 – Find All Elements That Appear More Than Once
Required Input:
[4, 3, 2, 7, 8, 2, 3, 1]
Expected Output:
3 2
Code In Python
def find_duplicates(arr):
# Write your logic here
pass
Run Code?
Click Run Button to view compiled output
25. Problem 25 – Check if Array Elements Can Be Paired Divisible by K
Required Input:
[9, 7, 5, 3]
6
Expected Output:
True
Code In Python
def can_pair(arr, k):
# Write your logic here
pass
Run Code?
Click Run Button to view compiled output


