Validate near-palindrome and course prerequisite feasibility | Meta Interview Question