Solved Funny String Problem on HackerRank with C Optimizations

🚀 Day 94 of #100DaysOfCode Today I solved the "Funny String" problem on HackerRank using C 💻 🔍 Problem Insight: A string is called Funny if the absolute differences between adjacent characters are the same when compared with its reverse. 👉 Instead of actually reversing the string, I optimized the solution by comparing characters from both ends — saving space and improving efficiency. 💡 Key Learning: Efficient string traversal techniques Avoiding unnecessary space usage Writing optimized logic with O(n) time complexity 🧠 Logic in Short: Compare: |s[i] - s[i-1]| with |s[n-i] - s[n-i-1]| If all match → ✅ Funny Else → ❌ Not Funny ⚡ Example: Input: acxz → Output: Funny Input: bcxz → Output: Not Funny Consistency in small optimizations builds strong problem-solving skills over time. #Day94 #100DaysOfCode #CodingJourney #HackerRank #CProgramming #ProblemSolving #DeveloperLife #LearnToCode #CodeDaily

To view or add a comment, sign in

Explore content categories