Amazon hackerearth hiring OA

Has anyone solved question number 2 minimum operations of hackearth Amazon hiring challenge?
If yes please post the solution or an explaination for it

Comments (1)