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 x, y from functions f1
where exists(select * from functions f2 where f2.y=f1.x
and f2.x=f1.y and f2.x>f1.x) and (x!=y)
union
select x, y from functions f1 where x=y and
((select count(*) from functions where x=f1.x and y=f1.x)>1)
order by x;
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 →
My solution: