title: Given a set of digits and operators, form the given number using least number of operations
body: <p>We were asked the following problem in a test and I'm not sure how to approach it:</p>
  
  <p>Given a set of numbers and a set of operators, find the least number of operations possible to generate the number.</p>
  
  <p>For example:<br>
  Input<br>
  <code>set of digits: {8, 1, 6, 2, 7}</code><br>
  <code>set of operations: {*, /, -}</code><br>
  <code>number to be generated: 981</code> <br><br>
  Output<br>
  <code>number of operations: 2</code><br><br>
  <code>Explanation: 981 = 16 * 62 - 11 [ 2 operations: * and - ]</code><br><br></p>
  
  <p>Constraints:<br>
  <code>all numbers to be used as integers</code><br>
  <code>0 &lt;= each number in set of digits &lt;= 9</code><br>
  <code>possible set of operations: { +, -, *, / } [ the division operation will always return an integer ]</code><br>
  <code>0 &lt;= number to be generated &lt;= 999</code><br>
  <code>it is necessary that while performing the operations, any of the calculated values must not exceed 999 or be negative</code><br>
  <code>the precedence of operations will always be from left to right, BODMAS/PEMDAS won't be followed. For example: 16*6+2*11 will be calculated as: ((16*6) + 2) * 11</code><br><br></p>
  
  <p>Any help in how to approach the solution would be greatly appreciated.</p>
  
  <p>I think the problem can be approached by generating a number closest to the given number and then the difference can be thought of a new problem of number to be generated. Although I don't think that would yield the least number of operations required to form the given number.</p>
  
  <p>Wasn't able to write much code as I'm not sure how to approach the solution.</p>
  
  <p>Thanks in Advance!</p>