← All problemsSign in

Earn with array

Basu has an array $A$ of $n$ integers and four values $x$ , $y$ , $kx$ and $ky$. The array is $0$ indexed (0 <= $i$ <= $n$-1). Basu can choose the element at an index $i$, if $i$%$x$ $== 0$ and mutiply it by $kx$ and earn the increase in the value (i.e., $A[i]*kx - A[i]$) similarly for $y$ if $i$%$y==0$ (He earns, $A[i]*ky - A[i]$ units) what is the minimum length of the array that Basu requir

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start