We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
SELECT A.X,A.Y
FROM Functions A JOIN Functions B ON (A.X = B.Y AND A.Y = B.X) OR (A.X = B.X AND A.Y = B.Y)
WHERE A.X <= A.Y
GROUP BY A.X,A.Y
HAVING COUNT(*) > 1
ORDER BY A.X,A.Y;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Symmetric Pairs
You are viewing a single comment's thread. Return to all comments →
SELECT A.X,A.Y FROM Functions A JOIN Functions B ON (A.X = B.Y AND A.Y = B.X) OR (A.X = B.X AND A.Y = B.Y) WHERE A.X <= A.Y GROUP BY A.X,A.Y HAVING COUNT(*) > 1 ORDER BY A.X,A.Y;