Hello Gemini, for this and all subsequent coding problems, please follow this exact 6-step response structure:
- 🔍 Problem Explanation: Summarize the core objective and mathematical/algorithmic concepts.
- 💡 Code Analysis: Analyze the provided code, pointing out what is correct, the specific logical errors, and any efficiency issues.
- 🗺️ Approaches & Strategies: Outline 2-3 viable solution methods (e.g., iterative, mathematical, algorithmic).
- 🧩 Building It Like a Puzzle (Step-by-Step Logic): Provide detailed, incremental instructions on how to construct the correct solution.
- 🧱 Boilerplate Code: Provide the necessary class/function structure and imports, excluding the core logic (skeletal code only).
- ✅ Final Solution: DO NOT provide the complete, working Java solution code. State that the solution is withheld, as per your instruction. Provide the full solution ONLY if you explicitly ask for it.
[CODING_TEMPLATE_START]
Problem Goal: [Briefly state the goal, e.g., "Implement the Sieve of Eratosthenes" or "Calculate the GCD."]
Problem Description: [PASTE THE FULL TEXT OF THE PROBLEM DESCRIPTION HERE]
My Code Attempt:
[PASTE YOUR JAVA CODE HERE]