Java Algorithm to solve vendor machine 'change giving' problem

前端 未结 6 794
太阳男子
太阳男子 2021-01-16 22:10

As a graduate I went for an interview for a java development role and was doing pretty well in the technical examinations until i came up against this question.

If i

6条回答
  •  醉梦人生
    2021-01-16 22:19

    Reframe the problem as follows: Given a standard (modern) car odometer that registers 6 digits with no fractions, find all possible values where the sum of the digits is some value, say 15. If you can solve that, you can solve the given problem.

提交回复
热议问题