An interesting problem that was asked in online hiring test of salesforce.

Revision en1, by randomrandom1810, 2022-06-16 13:32:03

We are provided with 2 integers, F and K and we want to find an integer N such that

  • N is minimum number which is divisible by F
  • N is minimum number whose sum of digits is an integer K return minimum N satisfying the 2 conditions.

constraints

1 <= F <= 495 1 <= K <= 5000

Please tell me how to approach this problem.

Tags problem, math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English randomrandom1810 2022-06-16 14:32:31 4
en2 English randomrandom1810 2022-06-16 14:29:04 32
en1 English randomrandom1810 2022-06-16 13:32:03 410 Initial revision (published)