title: Given an array of integers, find the LARGEST number using the digits of the array such that it is divisible by 3
body: <p>E.g.: Array: 4,3,0,1,5  {Assume all digits are >=0. Also each element in array correspond to a digit. i.e. each element on the array is between 0 and 9. }</p>
  
  <p>In the above array, the largest number is: 5430 {using digits 5, 4, 3 and 0 from the array}</p>
  
  <p>My Approach:</p>
  
  <p>For divisibility by 3, we need the sum of digits to be divisible by 3.
  So,</p>
  
  <ol>
  <li>Step-1: Remove all the zeroes from the array.</li>
  <li>Step-2: These zeroes will come at the end. {Since they dont affect the sum and we have to find the largest number}</li>
  <li>Step-3: Find the subset of the elements of array (excluding zeroes) such that the number of digits is MAXIMUM and also that the sum of digits is MAXIMUM and the sum is divisible by 3.</li>
  <li>STEP-4: The required digit consists of the digits in the above found set in decreasing order.</li>
  </ol>
  
  <p>So, the main step is STEP-3 i.e. <em>How to find the subset such that it contains MAXIMUM possible number of elements such that their sum is MAX and is divisible by 3</em> .</p>
  
  <p>I was thinking, maybe Step-3 could be done by GREEDY CHOICE of taking all the elements and keep on removing the smallest element in the set till the sum is divisible by 3.</p>
  
  <p>But i am not convinced that this GREEDY choice will work.</p>
  
  <p>Please tell if my approach is correct.
  If it is, then please suggest as to how to do Step-3 ?</p>
  
  <p>Also, please suggest any other possible/efficient algorithm.</p>