Validate near-palindrome and course prerequisite feasibility
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: These problems evaluate string-processing and graph-theoretic competencies, testing algorithmic reasoning about near-palindrome validation with edge-case handling and course-prerequisite feasibility via cycle and ordering concepts, and are commonly asked to assess correctness, efficiency, and robustness under input constraints.
Near Palindrome With One Deletion
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ('aba',)
Expected Output: True
Explanation: Already palindrome.
Input: ('abca',)
Expected Output: True
Explanation: Delete b or c.
Input: ('abc',)
Expected Output: False
Explanation: Cannot fix with one deletion.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.
Course Prerequisite Feasibility
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: (2, [[1,0]])
Expected Output: True
Explanation: Acyclic prerequisites.
Input: (2, [[1,0],[0,1]])
Expected Output: False
Explanation: Cycle prevents completion.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.