Solved anagram problem with hashmaps, not sorting.

🧩 𝐃𝐚𝐲 𝟏𝟓 𝐨𝐟 #𝟏𝟓𝟎𝐃𝐚𝐲𝐬𝐎𝐟𝐂𝐨𝐝𝐞 — 𝐕𝐚𝐥𝐢𝐝 𝐀𝐧𝐚𝐠𝐫𝐚𝐦 Today’s problem looked simple — check if two strings are anagrams. But I realized something deeper while solving it. You don’t always need fancy logic — just structured thinking. Instead of sorting both strings (O(n log n)), I used 𝐭𝐰𝐨 𝐡𝐚𝐬𝐡𝐦𝐚𝐩𝐬 to track character frequency (𝐎(𝐧)). Same result, cleaner path. It’s small problems like this that quietly sharpen how we think about efficiency, trade-offs, and structure — the foundation of building reliable AI systems later on. 🔗 https://lnkd.in/gy8jhWMz #Python #Algorithms #ProblemSolving #CodingJourney #AIEngineer #LeetCode #150DaysOfCode #EfficiencyMatters

To view or add a comment, sign in

Explore content categories