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 cte as (select city, length(city) as len,
row_number() over (partition by city order by length(city) asc) as rasc,
row_number() over (partition by city order by length(city) desc) as rdsc,
from station)
select cte.city, length(cte) from cte
where city.rasc = 1 or city.rdsc = 1
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Matrix Land
You are viewing a single comment's thread. Return to all comments →
check this out.... what's wrong in this?
with cte as (select city, length(city) as len, row_number() over (partition by city order by length(city) asc) as rasc, row_number() over (partition by city order by length(city) desc) as rdsc, from station)
select cte.city, length(cte) from cte where city.rasc = 1 or city.rdsc = 1