SMART
WORKZ
Toggle navigation
Home
Software Development
Integrations
Pricing
Contacts
Sign up
Edit Prompt
Action
Version
Default
Content
Task: Analyze & solve the given coding problem or code implementation efficiently and correctly from the provided input (image, problem statement, pseudocode, or code) on any online platform. 1. Problem Understanding Read and Analyze: Carefully read the problem statement, including any provided pseudocode, diagrams, or images, to fully understand the task. Identify Input/Output: Determine the exact input format, expected output, and key requirements. Note Constraints: Identify constraints such as data size limits, input ranges, and data types. Consider any specific conditions or limitations that must be handled. List Edge Cases: Highlight potential edge cases, such as: Empty input Null values Maximum/minimum limits Duplicates Negative values (if applicable) Clarify Assumptions: Identify any ambiguities and state reasonable assumptions to ensure clarity. Understand Provided Test Cases: Before implementing the solution, analyze all provided test cases, including edge cases, to understand the problem’s expectations. 2. Error Identification For Provided Code: If an initial code snippet is given, identify: Syntax errors Logical flaws Missing edge case handling For Problem Statement: Look for unclear instructions, incomplete problem descriptions, or inconsistent details. For Visuals (Diagrams/Images): Ensure any provided diagrams or images align with the problem's requirements and are interpreted correctly. 3. Data Structures and Algorithm Selection Choose Optimal Data Structures: Select the most appropriate data structures (e.g., arrays, hash maps, linked lists, trees, graphs) based on the problem requirements. Select the Best Algorithm: Pick the most efficient algorithm for the problem (e.g., sorting, searching, dynamic programming, graph traversal). Justify Complexity: Explain why the selected approach is optimal using Big O notation, ensuring it fits within the problem’s constraints. 4. Solution Design Outline Approach: Break down the problem into smaller, manageable tasks and define a step-by-step approach. Write Pseudocode: Create a high-level pseudocode to validate the logic before implementation. Handle Input Sizes: Design the solution to efficiently process both small and large input sizes. Consider Edge Cases: Ensure special cases are handled appropriately. 5. Code Implementation ({0} Preferred) Follow Best Practices: Use meaningful variable and function names. Write modular, reusable, and well-structured code. Follow proper indentation and formatting for readability. Platform-Specific Input/Output Handling: Ensure compatibility with the target online platform’s input/output format. 6. Testing Run Provided Test Cases: Validate the solution against all provided test cases, including extreme edge cases. Create Custom Test Cases: Include additional test cases to verify edge scenarios (e.g., empty arrays, large data sizes). Check Constraints Compliance: Ensure the solution meets the problem’s time and memory constraints with varying input sizes. 7. Optimization Analyze Performance: Assess the solution’s performance to identify potential optimizations. Optimize Time & Space Complexity: Apply techniques such as memoization, dynamic programming, or more efficient algorithms if needed. Reduce redundant computations and improve execution speed. Refactor Code: Improve code readability and efficiency by eliminating unnecessary steps. 8. Interview Preparation (If Applicable) Simulate Timed Practice: If this is for interview preparation, solve the problem under a timed environment. Explore Related Concepts: Study similar problem patterns and possible follow-up questions. 9. Company-Specific Focus (If Applicable) Research Common Patterns: If the problem comes from a company-specific set, research frequent coding patterns they ask in interviews. Consider Extensions or Variations: Think of ways the problem could be modified for different scenarios or follow-up questions. Key Focus Areas ✅ Correctness: Ensure the solution passes all test cases, including edge cases, without errors. ✅ Code Quality: Write clean, modular, maintainable {0} code with appropriate comments. ✅ Efficiency: Optimize time and space complexity within problem constraints. ✅ Scalability: Ensure the solution scales well for large inputs. Addressing Potential Input Errors In case of incorrect or incomplete input (e.g., misspellings, unclear problem descriptions), the solution should: Identify and suggest corrections (e.g., if "sorting without inbluid" is given, suggest "sorting without built-in functions"). Request missing details to ensure a complete and accurate solution. Clarify assumptions where necessary to resolve ambiguities.
Save
Clear