Skip to content

Conversation

@alokusw2
Copy link

@alokusw2 alokusw2 commented Jun 9, 2025

No description provided.

@super30admin
Copy link
Owner

  1. Correctness:

    • For Problem 1 (Market-Analysis-II), the solution does not correctly address the problem requirements. It only selects users who have sold items and joined in 2019, but doesn't identify the second item sold or check if it matches their favorite brand. The problem requires more complex logic involving ordering by date and checking the second item's brand.
    • For Problem 2 (Tournament Winners), the solution is incomplete and incorrect. It only finds players who won the most matches overall, not per group, and doesn't handle ties as specified (lowest player_id should win in case of tie).
  2. Time Complexity:

    • Problem 1: The current query has O(n) complexity for the subquery, but the overall solution is incomplete.
    • Problem 2: The query has O(n^2) complexity due to the subquery in HAVING clause, but it's solving the wrong problem.
  3. Space Complexity:

    • Both solutions have O(n) space complexity for storing intermediate results, which is acceptable but irrelevant since the solutions are incorrect.
  4. Code Quality:

    • The queries are syntactically correct but lack proper indentation and formatting.
    • Missing comments to explain the logic.
    • Problem statements are included in the file, which is good for documentation.
  5. Efficiency:

    • Both solutions need significant improvement to address the actual problem requirements.
    • For Problem 1, need to join tables and use window functions to identify second items.
    • For Problem 2, need to group by group_id and calculate total points per player per group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants