Please read the new rule regarding the restriction on the use of AI tools. ×

Can anyone solve this question?

Revision en1, by umang03, 2022-09-01 05:43:17

Someone please share the solution of the following question.

Given a binary array of size 10 which represents the state of the calculator. 1 means that digit is working. 0 means that digit is broken. Example -[0,1,1,0,0,1,0,0,0,0] indicates only digits 1, 2, 5 are working. Among the arithematic operators only multiply and equal buttons are working. You are given a number n which you have to form from this calculator. Find the minimum number of button presses you require to make the number n. Example

Calculator — [0,1,1,0,0,1,0,0,0,0] Number to form — 60 (n)

Make digit 12 (2 presses) Press x (1 press) Make digit 5 (1 press) Press = (1 press) 12 x 5 = 60 Total presses — 5 (which is the minimum number of presses required)

Tags #dfs, string

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English umang03 2022-09-01 05:43:17 796 Initial revision (published)