Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Can anyone solve this question?

Правка en1, от 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)

Теги #dfs, string

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский umang03 2022-09-01 05:43:17 796 Initial revision (published)