In a code language, 'pit dar na' means 'you are good', 'dar tok pa' means 'good and bad' and 'kim na tok' means 'boys are bad'. What are the codes for 'and' and 'you'?
and' is pa and 'you' is pit. Common words and common codes match up: good = dar (sentences 1 and 2), bad = tok (2 and 3), are = na (1 and 3). Removing those leaves pa for 'and' and pit for 'you'.
Explain it simply
In sentence coding, the order of code words is usually scrambled, so position tells you nothing. What helps is overlap: if a word appears in two sentences, its code must be the one code word those two sentences share. Find every shared word, match it, and the leftovers fall into place.
Example
Question:
- pit dar na = you are good
- dar tok pa = good and bad
- kim na tok = boys are bad
Find the codes for 'and' and 'you'.
- Sentences 1 and 2 share 'good' and the code 'dar'. So good = dar.
- Sentences 2 and 3 share 'bad' and the code 'tok'. So bad = tok.
- Sentences 1 and 3 share 'are' and the code 'na'. So are = na.
- Sentence 2 leftover: and = pa.
- Sentence 1 leftover: you = pit.
- Sentence 3 leftover: boys = kim.
const s1 = ["pit", "dar", "na"], s2 = ["dar", "tok", "pa"];
const common = s1.filter(w => s2.includes(w));
console.log(common); // Output: ["dar"]What to say in the interview
"I match shared words with shared codes. Good is dar, bad is tok and are is na. What's left in the second sentence, pa, must be 'and', and in the first, pit must be 'you'."
Common mistakes
- Assuming the code words are in the same order as the English words.
- Guessing a code from a single sentence without an overlap to confirm it.