I'm trying to solve a problem from hacker rank over here.
The question is:
So to solve this, I tried with a simple maths equation:
4x + 7y = lucky_number
For example, to check 15
is a lucky_number
or not, I could do start with x
, y
values 0
and substituting in the above equation until its equal or greater than (if so stop and say its not lucky number)
The above logic works fine. But the problem is with big number, imagine to check number 966888032206353
lucky or not, starting with x,y
to 0
wont be an efficient idea.
Any guidance to it?