Hello friends, if someone wants to help me with one task.
(I want example)
The task is:
One calculator can make two operations (multiply and subtract).
Return the minimum number of operations needed to get to target (or -1).
Your multiply number is 5
Your subtract number is 7
Your target number is 20
Starting with 1, we have:
Since we used 3 multiplications and 3 subtractions, the total amount is 6
int getCount(int M, int S, int T)
M - integer, the number used to multiply
S - integer, the number used to subtract
T - integer, the target number
int, minimum number of operations needed to get to target (or -1)
I can't solve this problem because I have problem with the dynamic programming, so if anyone wants to help me (give example, or code with example...) I would be very grateful.
Edited 6 Years Ago by Krstevski: n/a