15-Sep-2024 Capgemini Coding Question
15-Sep-2024 Capgemini Coding Question
15-Sep-2024 Capgemini Coding Question
https://www.youtube.com/@DebugWithShubham
https://www.linkedin.com/in/debugwithshubham/
https://www.instagram.com/debugwithshubham/
https://topmate.io/debugwithshubham
https://t.me/debugwithshubham
Question -1 Python
def find_dividend_index(A, D, Q, R):
target_dividend = D * Q + R
for i in range(len(A)):
if A[i] == target_dividend:
return i
return -1
A = [15, 25, 35, 45, 55] # The array of dividends
D=5 # Divisor
Q=7 # Quotient
R=0 # Remainder
N = len(A) # Length of array A
index = find_dividend_index(A, D, Q, R)
print(index)
Java
C++
Python Python
Question -2
Python Java C++