Hello,
I want to know How to find the maximum sum in an array given that no two elements of the combination have a common digit?
Yesterday, I was asked a question in the interview where I have to make an algorithm that will find the maximum sum in a given array such that the elements added doesn't have any common digits.
For example our array is: 31,44,46,63,65
So we cant add the elements: 31,63 as 3 is common But we can take up the elements 44, 65, 31 as none digits are common in these elements and also 65 > 63.
Can anyone think of a good approach in this?
Also, what if someone else tomorrow ask me another question which is as tough as this one is. So how can I prepare these types of questions? What material should I look at? Any suggestion would be appreciated a lot.
Thanks in advance.
0 Answer(s)