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.
# we can go with single loop alsodeffunnyString(s):r=s[::-1]compareList=[abs(ord(s[i+1])-ord(s[i]))if(i+1<len(s))elseNoneforiinrange(0,len(s))]compareList2=[abs(ord(r[i+1])-ord(r[i]))if(i+1<len(r))elseNoneforiinrange(0,len(r))]return'Funny'if(compareList==compareList2)else'NotFunny'
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Funny String
You are viewing a single comment's thread. Return to all comments →