Skip to content

Competitve Coding-1#1353

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

Competitve Coding-1#1353
mananrg wants to merge 1 commit into
super30admin:masterfrom
mananrg:master

Conversation

@mananrg

@mananrg mananrg commented Jun 12, 2026

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Interview Problem: Find Missing Number in a sorted array (Problem1.py)

Strengths:

  • Correct implementation of binary search for finding the missing element
  • Clean, readable code with appropriate variable naming
  • Good documentation with example inputs in comments
  • Proper handling of edge cases (the while loop condition low <= high is correct)
  • Optimal time and space complexity

Areas for Improvement:

  • The function could benefit from input validation (e.g., checking if the array is empty or checking if the array is actually sorted)
  • Consider adding more test cases to demonstrate the function works for different scenarios
  • The function assumes the array starts from 1, which matches the problem statement but could be documented more explicitly

Minor Note:
The return statement return low + 1 works because low will point to the index where the first discrepancy occurs (where li[low] != low + 1). This is correct, though it might be slightly clearer to return li[low-1] + 1 when low > 0 to show the logical connection to the previous element.

VERDICT: PASS


Interview Problem: Design Min Heap (Problem2.py)

Strengths:

  • Clean, well-organized code that closely follows the reference solution's logic
  • Correct implementation of all heap operations with proper edge case handling
  • Good use of Python's tuple unpacking for swap operation
  • Proper initialization with capacity-based array allocation

Areas for Improvement:

  • Consider adding an explicit getMin() method for clarity, even though the functionality is available via heap[0]
  • The printHeap() method could be enhanced to show the tree structure visually
  • Could add input validation and error handling for edge cases
  • Consider making the heap dynamic (resize when full) instead of fixed capacity

Overall, this is a solid implementation that demonstrates good understanding of heap data structures.

VERDICT: PASS

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