You can do it with a single pass through the list, maintaining the maximum
sum with every possible set of permitted digits (1024 values).

On Wed, 29 May 2019, 00:03 akshit bhatia, <[email protected]> wrote:

> Hello,
>
> I know this is not the right community to ask this coding problem, but
> please if possible, would be great if you can suggest me how to solve the
> following problem.
>
> 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 no
> elements in a combination 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?
>
>
> Thanks in advance. And once again I apologise for the off topic here.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/36b7a4e0-e9dc-4af4-8af6-7ebd4542f82c%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAE-ZSdJ4f7Nrq8LZPQ_2gEW1TU7fTA5QiJH5Ld1CnszqZarRVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to