"Day 31 of #100DaysOfDSA: Printing Array Pairs with Loops"

🔥 #100DaysOfDSA — Day 31/100 Topic: Pairs in an Array 👯♂️ 💡 What I Did Today: Today, I learned how to print all possible pairs from an array — a great exercise to understand nested loops and how combinations work in arrays. 🧠 Logic Used: Use two loops: Outer loop picks the first element. Inner loop pairs it with every following element. Keep a counter to track the total number of pairs. 📊 Example: Input → {2, 4, 6, 8, 10} Output → (2,4) (2,6) (2,8) (2,10) (4,6) (4,8) (4,10) (6,8) (6,10) (8,10) Total pairs = 10 ⚙️ Time Complexity: O(n²) because of the nested loops. Simple yet powerful way to grasp combinations in arrays. ✨ Takeaway: Working with array pairs really strengthens how I think about nested iterations and relationships between elements. Each small step builds stronger DSA intuition 💪 #100DaysOfCode #Day31 #Java #DSA #Arrays #CodingJourney #ProblemSolving #DeveloperLife #LearnInPublic #CodeNewbie #LogicBuilding

  • text

To view or add a comment, sign in

Explore content categories