Skip to content

Conversation

@kiran160195
Copy link

No description provided.

@super30admin
Copy link
Owner

  1. Correctness:

    • Problem1: The solution correctly groups by 'sell_date' and calculates both the number of unique products sold and a sorted comma-separated list of products. This appears to solve the problem correctly.
    • Problem2: The solution correctly groups by 'date_id' and 'make_name', then calculates unique counts for both 'lead_id' and 'partner_id'. The sorting at the end is a good touch.
    • Problem3: The solution correctly identifies actor-director pairs who have cooperated at least 3 times. The approach is correct but could be more efficient.
  2. Time Complexity:

    • Problem1: O(n log n) due to the sorting operation on unique products.
    • Problem2: O(n) for grouping and counting, plus O(k log k) for sorting where k is the number of groups.
    • Problem3: O(n) for grouping and counting, plus O(m) for filtering where m is the number of groups.
  3. Space Complexity:

    • All solutions have O(n) space complexity as they create new DataFrames from the input.
  4. Code Quality:

    • Overall good structure and readability.
    • Variable names are descriptive.
    • Problem3 has a typo ('coorporated' instead of 'cooperated') and an unnecessary print statement.
    • The lambda function in Problem1 could be named for better clarity.
  5. Efficiency:

    • Problem1: The sorting could be moved outside the aggregation for better readability.
    • Problem3: Could use groupby with size() directly in the filter condition to avoid creating an intermediate DataFrame.

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