You are viewing a single comment's thread. Return to all comments →
Here is my PHP solution:
function funnyString($s) { // Write your code here $s_new = str_split($s); $s_new_reverse = array_reverse($s_new); $hasil = "Funny"; for ($i=0; $i < count($s_new)-1; $i++) { if (abs(ord($s_new[$i]) - ord($s_new[$i+1])) !== abs(ord($s_new_reverse[$i]) - ord($s_new_reverse[$i+1]))) { $hasil = "Not Funny"; break; } } return $hasil; }
Seems like cookies are disabled on this browser, please enable them to open this website
Funny String
You are viewing a single comment's thread. Return to all comments →
Here is my PHP solution: