Question 1

You have L, a list containing some digits (0 to 9). Write a function answer(L) which finds the largest number that can be made from some or all of these digits and is divisible by 3. If it is not possible to make such a number, return 0 as the answer. L will contain anywhere from 1 to 9 digits. The same digit may appear multiple times in the list, but each element in the list may only be used once.


Test cases



(int list) l = [3, 1, 4, 1]


(int) 4311


(int list) l = [3, 1, 4, 1, 5, 9]


(int) 94311


[advanced_iframe securitykey=”undefined” src=”” width=”100%” height=”600″]

KodNest Training New Batch is starting on 02nd November 2020. Attend one week free demo classes.Register Now

New Report