Evaluate Recruiter Boolean Search Queries Against Candidate Profiles

Last updated: November 29, 2026

Quick Overview

Recruiters type queries like '(java OR kotlin) AND NOT intern'. Given such a query string with AND, OR, NOT, parentheses, and keyword terms, plus a set of keywords on a profile, return whether the profile matches. NOT binds tightest, then AND, then OR.

LinkedIn
Coding & Algorithms
Software Engineer
LinkedIn
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Recruiters type queries like '(java OR kotlin) AND NOT intern'. Given such a query string with AND, OR, NOT, parentheses, and keyword terms, plus a set of keywords on a profile, return whether the profile matches. NOT binds tightest, then AND, then OR.

LinkedIn Recruiter supports exactly this kind of Boolean search, so the problem is very on-brand. Interviewers evaluate tokenization, a correct precedence-respecting parser (recursive descent or shunting yard), and clean error handling for malformed queries.

What the Interviewer Expects
  • Tokenizes into terms, operators, and parentheses
  • Writes a grammar with one function per precedence level
  • Implements recursive descent with correct NOT > AND > OR precedence
  • Handles nested parentheses and raises on malformed input
  • Treats keywords case-insensitively
  • Explains how the parsed tree would compile into an inverted index query
Key Topics to Cover
recursive descent parsing
operator precedence
tokenization
boolean logic
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you support implicit AND between adjacent terms?
  • How would you add quoted phrases like "machine learning"?
  • How do you evaluate this against an inverted index instead of a single profile?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Grammar:

  • expr := term (OR term)*
  • term := factor (AND factor)*
  • factor := NOT factor | '(' expr ')' | WORD

Operators are uppercase keywords; terms match the profile's keyword set case-insen...

High-Level Design

Tokenize with a regex that captures parentheses and runs of non-space, non-paren characters. Then parse with one function per grammar rule and a shared position index. Precedence falls out of the call...


Submit Your Answer
Markdown supported