Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Find Maximum Sum in Array so That No 2 Combination Elements Have Common Digit?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 502
    Answer it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: