finding interesting numbers

abridged, find # of numbers between and that fulfill cond that at least half of the number contains the same digit

  • build numbers starting with the prefix
  • with : position to add digit, : balance of present (at end, non-negative achieves half cond), : cond if under , : if non-zero digit has been placed
  • for each digit 0-9, pick as a for the entire dp run for solving , for the entire algorithm on a given
  • for a given , try adding a digit 0-9 at . update (inc), (if confirmed to be under ), (if is non-zero). for , if , then inc, else decr. then calc as sum of those
  • duplicate handling omitted, basically checking for exactly half and half (counted as one by problem statement, counted as two by program)