Skip to content

Conversation

@arushi2106
Copy link

No description provided.

@super30admin
Copy link
Owner

  1. Correctness:

    • Q1 (GamePlayAnalysis2_Join.sql): The solution correctly identifies the first login date for each player and retrieves the device used. However, if a player used multiple devices on their first day, it will return multiple rows, which may or may not be the intended behavior.
    • Q2 (GamePlayAnalysis3_sumover.sql): The solution correctly implements a running sum of games played using window functions.
    • Q4 (CombineTbles_leftjoin.sql): The solution correctly implements a left join to retrieve all persons with their address information if available.
    • Q5 (Strly_Inc_Purch.sql): The solution attempts to find customers with strictly increasing purchases year over year, but the logic is complex and the comment suggests it might not handle all edge cases correctly.
  2. Time Complexity:

    • Q1: O(n) for the CTE and O(n) for the join, where n is the number of records in Activity.
    • Q2: O(n log n) due to the window function's sorting operation.
    • Q4: O(n) for the left join operation.
    • Q5: O(n²) due to the self-join operation.
  3. Space Complexity:

    • All solutions create temporary tables or perform joins, resulting in O(n) space complexity.
  4. Code Quality:

    • The code is generally well-structured and readable.
    • Comments are helpful but could be more concise.
    • Q5's solution is overly complex and could be simplified with better window function usage.
    • Table aliases are used appropriately.
  5. Efficiency:

    • Q1 could be optimized by using ROW_NUMBER() instead of a join to avoid potential duplicates.
    • Q5 could be simplified by using LAG() or LEAD() window functions to compare consecutive years directly.
    • Missing solution for Q3 (ShortestDistance.sql).

@arushi2106
Copy link
Author

Added solution for Q3 Shortest distance (Sql6)

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