Skip to content

Conversation

@Tejas274
Copy link

@Tejas274 Tejas274 commented Jun 8, 2025

No description provided.

@Tejas274 Tejas274 changed the title prob 1 and 2 added prob-1 and 2 added Jun 8, 2025
@super30admin
Copy link
Owner

  1. Correctness:

    • For problem1-1148-article-views-I.py, the solution correctly identifies authors who viewed their own articles, removes duplicates, renames the column, and sorts the result. Both implementations (the first one and the more concise second one) achieve the same result correctly.
    • For problem2-1148-invalid-tweets.py, the solution correctly identifies tweets with content length greater than 15 characters and returns their tweet IDs.
  2. Time Complexity:

    • For problem1: The filtering operation is O(n), where n is the number of rows in the DataFrame. The drop_duplicates operation is O(n log n) in the worst case. Sorting is also O(n log n). Overall, the time complexity is O(n log n).
    • For problem2: The string length operation is O(n), where n is the number of rows in the DataFrame. The filtering is O(n). Overall, the time complexity is O(n).
  3. Space Complexity:

    • For problem1: The space complexity is O(n) in the worst case due to potential intermediate DataFrames being created.
    • For problem2: The space complexity is O(n) as it creates a new DataFrame for the result.
  4. Code Quality:

    • For problem1: The second implementation is more concise and uses method chaining, which is a good practice. However, having two identical function definitions is redundant and should be removed.
    • For problem2: The solution is concise and correct, but could benefit from method chaining for better readability.
  5. Efficiency:

    • For problem1: The solution is efficient, but the redundant function definition should be removed.
    • For problem2: The solution is efficient, but consider using method chaining for better readability.

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