FastPrepKnights, Knaves and Their Statements
Problems/Knights, Knaves and Their Statements

Knights, Knaves and Their Statements

Susquehanna International Group (SIG) logoSusquehanna International Group (SIG)● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A 2026 report on SIG's one-hour online test for quant research and systematic trading interns includes a classic island logic question. Two people, each either an honest knight or a lying knave, each say one thing. One is about whether the pair are of the same kind, and one is about the other person's honesty. You decide who is which.

The report has only that two-person case. We chose these. There can be any number of people from 2 to 20, each making one statement of four fixed kinds (someone is a knight, someone is a knave, two people are the same type, two people are of different types). The answer is the unique assignment written as letters, or NONE or MANY when there is no assignment or more than one. The interview case is the first example.

Our version is about 85% the same as the reported question.

There are n people, numbered 0 to n - 1. Each person is either a knight, who always tells the truth, or a knave, who always lies.

Person i makes exactly one statement, statements[i], in one of these forms (j and k may be any people, including the speaker):

  • "KNIGHT j": person j is a knight.
  • "KNAVE j": person j is a knave.
  • "SAME j k": persons j and k are the same type.
  • "DIFFERENT j k": persons j and k are different types.

If exactly one assignment of types is consistent with all statements, return it as a string of length n whose i-th character is 'K' (knight) or 'N' (knave). Return "NONE" if no assignment is consistent and "MANY" if more than one is.

Function

knightsAndKnaves(statements: String[]) → String

Examples

Example 1

statements = ["DIFFERENT 0 1","KNAVE 0"]return = "KN"

This is the interview case. Person 0 says the two of them are of different types, and person 1 says person 0 is a knave.

If 0 is a knight, the two differ, so 1 is a knave, and 1's claim that 0 is a knave is false, as a knave's claim should be. If 0 were a knave, they would be the same type, so 1 would be a knave too, but then 1's claim would be true. So the answer is "KN".

Example 2

statements = ["KNIGHT 0","KNIGHT 1"]return = "MANY"

Each person says they are a knight, which every person can say. All four assignments fit, so the answer is "MANY".

Example 3

statements = ["KNAVE 0","KNIGHT 0"]return = "NONE"

Person 0 says "I am a knave". A knight cannot say it (it would be false) and a knave cannot say it (it would be true). No assignment fits: "NONE".

Constraints

  • 2 <= statements.length <= 20
  • Each statement is "KNIGHT j", "KNAVE j", "SAME j k" or "DIFFERENT j k" with single spaces, where 0 <= j, k < statements.length are written without leading zeros.

More Susquehanna International Group (SIG) Online Assessment questions

  • Catch Fish with Reusable BaitsOA · Seen Nov 2026
  • Bold Play to Reach a GoalOA · Seen Nov 2026
  • Cats, Truth and Who Has MoreOA · Seen Nov 2026
  • Counting Cows by Their LegsOA · Seen Nov 2026
  • Enough Muffins for the LineOA · Seen Nov 2026
  • Expected Consecutive Pairs Among Chosen NumbersOA · Seen Nov 2026
  • Four-by-Four Boundary GridOA · Seen Nov 2026
  • Frog Paths Without Long RunsOA · Seen Nov 2026
  • Higher Roll, or Lose the SumOA · Seen Nov 2026
  • Is a Popular Story Fake?OA · Seen Nov 2026

Similar questions at other companies

  • Choose the Next Minesweeper ActionRunloop · PHONE SCREEN
  • Count Subarrays with a Perfect-Square ProductMicrosoft · OAMicrosoft interview questions
  • Repeated Mirror XORMathWorks · OAMathWorks interview questions
  • Minimum Power-of-Two Removal OperationsIBM · OAIBM interview questions
  • Next Number with Disjoint DigitsElevenLabs · OAElevenLabs interview questions
  • Minimum Power-of-Two Removal OperationsVisa · OAVisa interview questions
  • Beautiful Number OrderingsDocuSign · OADocuSign interview questions
  • Minimum Operations To Reduce To ZeroUber · OAUber interview questions
  • City Infection NumberArcesium · OAArcesium interview questions
  • Minimum Power-of-Two AdjustmentsNVIDIA · OANVIDIA interview questions

Susquehanna International Group (SIG) interview experiences

  • SIG Quant Researcher Experienced Hire Interviews: 11 Experiences
  • SIG Quant Research Intern Interviews: 60 Experiences
  • SIG Quant Researcher New Grad Interviews: 49 Experiences
  • SIG Quant Researcher Intern Interviews: 1 Experience
  • SIG Quant Second-Round Tech Screen: 1 Experience
All Susquehanna International Group (SIG) interview questionsSee Susquehanna International Group (SIG) hiring insights
Saved
class Solution {
    public String knightsAndKnaves(String[] statements) {
        // Write your code here.
    }
}
Checking account…