This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def logic(N, M, F, B): | |
# logic here | |
frontend = {} | |
backend = {} | |
for i in range(N + M): | |
frontend[i] = F[i] | |
backend[i] = B[i] | |
frontend = dict(sorted(frontend.items(), key=lambda x: x[1])) | |
backend = dict(sorted(backend.items(), key=lambda x: x[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def klees_super_duper_large_array(): | |
n, k = map(int, input().split()) | |
""" | |
# prefix sum appraoch - O(n) time and O(n) space - gives MLE and TLE | |
prefix_sum_array = [0] * n | |
for i in range(n): | |
prefix_sum_array[i] = k | |
if i > 0: | |
prefix_sum_array[i] += prefix_sum_array[i - 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t = "#" + input() | |
n = len(t) | |
longest_valid = "" | |
for i in range(2, n): | |
left_substring = t[1 : i + 1] | |
right_substring = t[i : i + len(left_substring)] | |
# print(f"left sub: {left_substring}; right sub: {right_substring}") | |
if left_substring == right_substring: | |
if len(left_substring) > len(longest_valid): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n, k = map(int, input().split()) | |
a = list(map(int, input().split())) | |
a.sort() | |
if k == 0: | |
min_ele = a[0] | |
if min_ele == 1: | |
print(-1) | |
else: | |
print(min_ele - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Development of AI/ML-based solution for detection of face-swap-based deep fake videos (SIH1683) | |
2. Micro-Doppler based Target Classification (SIH1606) | |
3. AI-powered Student Assistance Chatbot for Department of Technical Education (SIH1631) | |
4. AI tool/mobile app for Indian Sign Language (ISL) generator from audio-visual content (SIH1715) | |
5. Detection of Oil Spills at Marine Environment using Automatic Identification System (AIS) and Satellite Datasets (SIH1655) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
respect = [1] * (n + 1) | |
for i in range(1, n + 1): | |
p, c = map(int, input().split()) | |
if not c: | |
respect[i] = respect[p] = 0 | |
res = set(i for i in range(1, n + 1) if respect[i]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def forbidden_integer(): | |
n, k, x = map(int, input().split()) | |
if x != 1: | |
# We can always form n using 1's | |
print("YES") | |
print(n) | |
print(" ".join(["1"] * n)) | |
elif n > 1 and k > 1: | |
# We can for n using 2's and possibly one 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# input | |
n, s = map(int, input().split()) | |
a = [0] + list(map(int, input().split())) + [0] | |
b = [0] + list(map(int, input().split())) + [0] | |
# logic | |
reachable = False | |
for i in range(1, n + 1): | |
if i == 1 and a[i] == 0: | |
print("NO") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def long_jumps(): | |
# input | |
n = int(input()) | |
a = list(map(int, input().split())) | |
# logic | |
globalMaxScore = float("-inf") | |
ptr = 0 | |
while ptr < n: |
NewerOlder