SMART
WORKZ
Toggle navigation
Home
Software Development
Integrations
Pricing
Contacts
Sign up
Edit Prompt
Action
Version
Default
Content
Task: Analyze and solve the given problem efficiently using {0}. The input may be provided in various forms, such as images, code snippets, pseudocode, or text descriptions. The solution must be correct, optimized, and scalable while handling all edge cases effectively. 1. Input Analysis Understanding the Provided Input Format: For Images: Extract and analyze any code, pseudocode, diagrams, or flowcharts directly. Identify relevant use cases, requirements, and constraints. For Code/Pseudocode: Identify the programming language or paradigm being used. Detect and list code issues, syntax errors, logical inefficiencies, and areas for optimization. For Text Descriptions: Extract key requirements, input/output specifications, and constraints. Identify any missing details or ambiguities and document reasonable assumptions. Edge Cases Consideration: Check for null inputs, empty arrays, boundary values, duplicate data, negative values, and other edge cases. Review Provided Test Cases: Analyze all given test cases or examples to understand problem expectations. 2. Problem Identification and Solution Design Defining the Core Problem: Clearly state the main objective or task to be solved. If the problem involves fixing a provided code snippet, explain the errors/issues and how your solution resolves them. Choosing the Right Approach: Select the most efficient data structures and algorithms based on the problem requirements. Consider the frontend and backend aspects if applicable. Address platform constraints (e.g., input/output handling, memory limits, execution time constraints). Evaluate scalability and parallelization if large datasets or high performance are required. If required, provide a system design approach to ensure maintainability. Analyzing Complexity: Time Complexity: Justify the efficiency of the algorithm using Big O notation. Space Complexity: Optimize memory usage for better performance. 3. Implementation in {0} Writing the Code Efficiently: Implement the solution using {0} best practices. Use meaningful variable names, modular functions, and proper error handling. Ensure the code is structured for reusability, readability, and maintainability. Handling Edge Cases and Errors: Implement conditions to handle null values, out-of-range inputs, performance bottlenecks, etc. Use try-catch blocks for exception handling where necessary. Modifying Existing Code (If Provided): Clearly indicate and explain changes made to the original code. Ensure the solution fixes all identified code issues and errors. Platform-Specific Considerations: Follow the input/output format requirements of the target platform (e.g., Leetcode, Codeforces, HackerRank, etc.). 4. Testing and Optimization Validating the Solution: Execute all provided test cases to ensure correctness. Add custom test cases covering edge scenarios and previously identified code issues. Optimization Strategies: Refactor the code to improve readability and reduce unnecessary computations. Enhance performance using: Memoization (if applicable) Efficient sorting/searching algorithms Parallel processing (if needed) Reducing redundant loops or computations Final Verification: Double-check that all identified errors and inefficiencies are resolved. Utilize platform-specific testing features (if available) to validate the solution before submission. Ensure compliance with memory and execution constraints. Key Focus Areas for the Solution ✅ Correctness – Ensure the solution works for all test cases, including edge cases and input constraints. ✅ Efficiency – Optimize time and space complexity while ensuring correctness. ✅ Code Quality – Write clean, modular, well-commented code for readability and maintainability. ✅ Adaptability – Handle different input types, including images, pseudocode, or incomplete statements. ✅ Problem-Solving – Address both the core problem and any specific code-related issues. Additional Considerations: Handling Visual Input (Diagrams, Screenshots): Directly analyze and interpret visual elements without unnecessary textual descriptions. Extract relevant information efficiently and apply it to the problem. Document Assumptions: If any details are missing, state clear assumptions to ensure consistency. Time Management: Allocate sufficient time for problem analysis, coding, testing, and optimization. Scalability and Performance Considerations: Design the solution to handle large datasets, concurrent processing, and high-load scenarios if applicable. Follow-Up Enhancements: If solving for an interview or competitive programming, consider possible modifications or variations of the problem. Final Notes: Before Submission: Double-check that all initial code issues, errors, and inefficiencies have been resolved. Confirm that the solution is optimized, correct, and meets all constraints. If applicable, use the platform's automated testing tools to validate your solution before finalizing.
Save
Clear