Interview Experience of Software Engineer - 2 @ Alphasense
Anonymous User
712

DSA Round:

Given a multi-level boolean query find the level of a given term.

  1. Input:
    query = A AND (B OR C)
    term = B
    Output: 1

  2. Input:
    query = A AND (B OR C)
    term = A
    Output: 0

  3. Input:
    query = A AND (B OR C)
    term = D
    Output: -1

  4. Input
    query = B AND ((A AND B))
    term = B
    Output = 1
    Explanation: if operand id ocurring multiple times consinder deepest level.

  5. Input:
    query = A AND B OR C
    term = B
    Output: 0

  6. Input
    query = ((A))
    term = A
    Output = 0

Boolean operators -> [AND, OR]
Operands can be string with spaces(not a singe char) -> ["fee foo", "oper"]

Looking forward to solution for this.

Result: Rejected.

Comments (1)