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.
with t1 as
(select least(x,y) as x1,greatest(x,y) as y1 from functions
),
t2 as
(select greatest(x,y) as x2,least(x,y) as y2 from functions
),
t3 as (
select x1,y1,x2,y2
from t1,t2
where x1=y2 and y1=x2
),
t4 as
(select x1,y1 from t3
where x11
order by x1
;
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 →
with t1 as (select least(x,y) as x1,greatest(x,y) as y1 from functions ), t2 as (select greatest(x,y) as x2,least(x,y) as y2 from functions ), t3 as ( select x1,y1,x2,y2 from t1,t2 where x1=y2 and y1=x2 ), t4 as (select x1,y1 from t3 where x11 order by x1 ;