Skip to main content
Saved 3 bytes thanks to @Mr.Xcoder
Source Link
user48543
user48543

Pyth, 1212 9 bytes

Try it

e@.*m-SdeS@Fm.-m/d{

Try it Saved 3 bytes thanks to Mr. Xcoder.

Explanation

e@.*m-SdeS@Fm.-m/d{
    m Sd   /d   Count the Sortoccurrences Aof andeach Belement.
     -.m  .-d{   Take Removeonly those that appear the duplicatedminimum elementsnumber fromof eachtimes.
 @.* @F        Apply the above Taketo theA intersection.
eand B and take the intersection.
eS          Take the last (largest).

Pyth, 12 bytes

e@.*m-Sd.-d{

Try it

Explanation

e@.*m-Sd.-d{
    m Sd        Sort A and B.
     -  .-d{    Remove the duplicated elements from each.
 @.*            Take the intersection.
e               Take the last (largest).

Pyth, 12 9 bytes

Try it

eS@Fm.m/d

Saved 3 bytes thanks to Mr. Xcoder.

Explanation

eS@Fm.m/d
    m  /d   Count the occurrences of each element.
     .m     Take only those that appear the minimum number of times.
  @F        Apply the above to A and B and take the intersection.
eS          Take the largest.
Source Link
user48543
user48543

Pyth, 12 bytes

e@.*m-Sd.-d{

Try it

Explanation

e@.*m-Sd.-d{
    m Sd        Sort A and B.
     -  .-d{    Remove the duplicated elements from each.
 @.*            Take the intersection.
e               Take the last (largest).