Problem Statement
Given an array of integers ( A ), and two integers ( S ) (start value) and ( D ) (destination value), you are allowed to perform any of the following operations on a value ( x ):
Each operation counts as one move. Determine the minimum number of moves required to transform the integer ( S ) into the integer ( D ) using the operations above. If it's not possible to achieve this transformation, return (-1).Input( A ): An array of integers.( S ): The starting integer.( D ): The target integer.
OutputThe minimum number of moves required to convert ( S ) to ( D ), or (-1) if it's impossible.Example Test CaseInput:
A = [6, 2, 7, 7]
S = 10
D = 21
Output:3