Skip to content · ⁨الانتقال إلى المحتوى⁩

Group anagrams · ⁨تجميع الأنagrams⁩

English

Group anagrams

Two words are anagrams if they use exactly the same letters, like eat and tea. Group the anagrams together and return a list of groups.

The trick: sort the letters of each word to make a key — eat and tea both become aet. Words with the same key belong in the same group. Use a dictionary from key → list of words, and remember the order the keys first appear.

العربية

تجميع المتشابهات

كلمتان تكونان متشابهتين إذا كانتا تستخدمان نفس الأحرف بالضبط، مثل eat وtea. قم بتجميع المتشابهات معاً وأعد قائمة بالمجموعات.

الحيل: رتب أحرف كل كلمة لتكوين مفتاح — eat وtea كلاهما يصبحان aet. الكلمات ذات المفتاح نفسه تنتمي إلى نفس المجموعة. استخدم قاموساً من المفتاح → قائمة بالكلمات، وتذكر الترتيب الذي تظهر فيه المفاتيح لأول مرة.

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP