Google Girl Hackathon 3 June 2023 Solutions Google Girl Hackathon 2023 Maximize equal numbers Code in Python Task Determine the maximum length of the subsequence of array a, such that all numbers in that subsequence are equal after applying the given operation. Code in Python def MaximizeEqualNumber(n, k, a): #Telegram - @PLACEMENTLELO max_length = 0 for i in range(n): #Telegram - @PLACEMENTLELO count = 1 for x in range(-k, k+1): #Telegram - @PLACEMENTLELO if a[i] + x in a[i+1:]: count += 1 #Telegram - @PLACEMENTLELO max_length = max(max_length, count) return max_length n = 4 k = 1 a = [2, 5, 1, 2] # Output: 3 n = 4 k = 0 a = [2, 2, 5, 6] # Output: 2 n = 3 k = 2 a = [1,5,6] # Output: 2 That is Perfection Code in Python def is perfect number (n): divisors_sum = sum(i for i in range(1, n) if n % i == 0) return divisors_sum == n Balanced Brackets You are given a string S of length N. It consists
Job Alerts, Coding Solutions, Interview Material, Placement Material