Skip to content

Completed S30 Completitive-Coding-2#1189

Open
prenastro wants to merge 1 commit into
super30admin:masterfrom
prenastro:master
Open

Completed S30 Completitive-Coding-2#1189
prenastro wants to merge 1 commit into
super30admin:masterfrom
prenastro:master

Conversation

@prenastro

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Two Sum (01knapsack.py)

  • The submitted solution addresses a completely different problem (0/1 Knapsack) rather than Two Sum
  • The code structure and comments are excellent for the knapsack problem
  • To improve: Ensure you understand the problem requirements before coding
  • For Two Sum, you would need to find two array indices whose values sum to the target
  • Consider using a hash map approach for O(n) solution to Two Sum

VERDICT: NEEDS_IMPROVEMENT


Interview Problem: 0-1 Knapsack Problem (twosum.py)

  • Major Issue: You submitted a solution for "Two Sum" but the assignment was to solve the "0-1 Knapsack Problem". Please ensure you read the problem requirements carefully before submitting.

If you intended to solve the 0-1 Knapsack Problem, here are some hints:

  • Use a 2D DP array where dp[i][w] represents the maximum value achievable with the first i items and capacity w
  • For each item, decide whether to include it (if weight fits) or exclude it
  • The recurrence relation is: dp[i][w] = max(dp[i-1][w], profit[i-1] + dp[i-1][w-weight[i-1]])

VERDICT: NEEDS_IMPROVEMENT

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