Filtering for even numbers divisible by 3 in Java

Even the simplest filtering problems sharpen logical precision. ✅ 🚀 #Day68 of #100DaysOfCodeChallenge Today was about clean iteration and condition-based filtering . 📌 Problem 01: Average Value of Even Numbers That Are Divisible by Three (Easy) Given an array of positive integers, return the average of all even numbers that are divisible by 3. If none exist, return 0. 🧠 Logic: Traverse the array once. Check if a number is divisible by 6 (since even + divisible by 3 ⇒ divisible by 6). Maintain sum and count of valid numbers. If count is 0, return 0. Otherwise, return sum / count (integer division). Day 68 complete ✅ Consistency over intensity. Keep building. 🚀 #100DaysOfCode #Day68 #LeetCode #DSA #Arrays #Math #Java #ProblemSolving #CodingJourney #LearnInPublic #Consistency

  • graphical user interface, text

Nice! I like how you explained the logic clearly

See more comments

To view or add a comment, sign in

Explore content categories