JavaScript (ES6), 49 48 47 4745 bytes
Saved 2 bytes thanks to @user81655
a=>a.sort(g=(p,q)=>p*q?g=>!p|-!q||g(p&p-1,q&q-1):!p-!q)[0]
How?
We .sort()
the input list with a recursive function that, given p
and q
, clears the least significant bit set in each variable until one of them is equal to 0 (or both of them simultaneously). This allows to order the list from most to least bits set. We then return the first entry, i.e. the "bittiest" one.
Commented
a => // a[] = input list
a.sort( // sort a[] ...
g = (p, q) => // ... using the recursive function g:
!p *| -!q ? // if both p-> and+1 qif arep ≠= 0:
g( and q ≠ 0,
// do a recursive call:
// p & por - 1, // if q = 0,
clear the least significant bit set|| in p
q &// q - 1 //or 0 if p ≠ 0 clearand theq least≠ significant0, bitin setwhich incase q...
) g( // end of recursive call
... we do a recursive call:
// else:
p & !p - !q 1, // return +1 ifclear pthe =least 0significant andbit qset ≠in 0,p
q & q - 1 // orclear -1the ifleast psignificant ≠bit 0set andin q = 0
) // or 0 if p =end qof =recursive 0call
)[0] // end of sort(); return the first entry