Skip to content

feat" problem 3,4,2 added#57

Open
Tejas274 wants to merge 2 commits intosuper30admin:mainfrom
Tejas274:main
Open

feat" problem 3,4,2 added#57
Tejas274 wants to merge 2 commits intosuper30admin:mainfrom
Tejas274:main

Conversation

@Tejas274
Copy link

@Tejas274 Tejas274 commented Jun 6, 2025

No description provided.

@super30admin
Copy link
Owner

  1. Correctness:

    • Problem 2 (big_countries): The solution correctly filters countries based on area or population criteria and returns the required columns. This appears correct.
    • Problem 3 (find_products): The solution correctly filters products that are both low fat and recyclable, returning only the product_id as required.
    • Problem 4 (find_customers): The solution correctly identifies customers who never placed orders using a left merge and null check on customerId.
  2. Time Complexity:

    • Problem 2: O(n) where n is the number of rows in the DataFrame, due to the filtering operation.
    • Problem 3: O(n) for the same reason as above.
    • Problem 4: O(n + m) for the merge operation where n and m are the sizes of customers and orders DataFrames respectively, plus O(n) for the filtering.
  3. Space Complexity:

    • Problem 2: O(n) in the worst case if all rows meet the criteria.
    • Problem 3: O(n) in the worst case if all products meet the criteria.
    • Problem 4: O(n + m) for the merged DataFrame.
  4. Code Quality:

    • The code is generally clean, concise, and follows pandas best practices.
    • Variable names are appropriate and the logic is straightforward.
    • The solutions are well-structured with proper spacing and imports.
    • One minor improvement could be adding docstrings to explain the functions' purposes.
  5. Efficiency:

    • All solutions are efficient for their respective problems.
    • For Problem 4, an alternative approach using ~customers['id'].isin(orders['customerId']) might be slightly more memory efficient as it avoids creating a merged DataFrame, but the current solution is perfectly acceptable.

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