QUESTION

Text
Image


Question 22 $00: 52: 16$ Alice and her gadget Max score. 2600 Alice recently bought a gadget, having seven-segment display. The gadge is having seren switches named a,b,c,de, Ig, and each switch corresponds to a segment lo be displayed in the gadget. Alice found a suing of numbers, now she decided to display each number in her gadget one by one. The gadgel can display only one number from her string at a time Numbers are displayed in the below pattein. 14 15 16 17 18 19 20 21 7-Segment Display Alice is a bil lazy, she vrants to do the minimum number of loggle Initally, all swit


0122 Completed $00: 51: 49$ off. Help Alce to lind her that minimum number. Example Consider Length $=2, \mathrm{~N}=15$. You must determine the minimum number of logjes iequied. For displaying I we need to loggle 2 switches 13 For displayng 5 atier 1 , we need to toggle 5 swiches. A So, the answer vould be 7 Function description 15 Complete the solve luncion provided in the edroc this tuncion trikes the loliouing 2 parameters and ieturis the minimum number of toggles iequited. 16 - Length Represents the length of the given stoing. $\pi$ - N. Represents the given string Input format 13 Note: This is the inpur format that you must use lo proride custom lapul (aratibic abore the Comple and Test bution). 19 Flist tine contains $T$, denoting the number of test coses. Each $T$ ine is having wo lines, the first line denotes the lengti of stimg $\mathrm{N}$ and the second ine 20 denoles the string $\mathrm{N}$ Output formal Print single integer for each $T$, denoting the minimum number of loggle equired 21 (22) $1 \leq \mathrm{T} \leq 1000$ \[ 1 \leq|N| \leq 10^{0} \]


Please send the solutions fast and preferably in c++

Public Answer

TVX8CX The First Answerer