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

Most frequent character · ⁨أكثر حرف تكراراً⁩

English

Most frequent character

Return the character that appears most often in a non-empty String. If two characters tie, return the one that appears earliest. A simple approach: for each character, count how many times it occurs, and keep the best so far — using a strict > so a tie keeps the earlier character.

العربية

الأكثر تكراراً

أدرِ الحرف الذي يظهر أكثر من مرة في String غير الفارغة. إذا تعادل حرفان، أعدّ الذي ظهر أولاً. نهج بسيط: لكل حرف، عدّ كم مرة يظهر، واحتفظ بالأفضل حتى الآن — باستخدام > صارم حتى يحافظ التعادل على الحرف الأقدم.

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

IGCSE, A-Level & AP