FastPrepABO Parent Genotype Combinations
Problems/ABO Parent Genotype Combinations

ABO Parent Genotype Combinations

Upstart logoUpstart● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report asks for the possible parent genotype pairs from two parent phenotypes and a child phenotype. It leaves out the encoding and the output order. The standard ABO rules below are about 84% the same as the reported question.

Use the usual simple ABO blood-type model. A person's blood type is the phenotype, and the pair of alleles behind it is the genotype:

  • Phenotype A has genotype AA or AO.
  • Phenotype B has genotype BB or BO.
  • Phenotype AB has genotype AB.
  • Phenotype O has genotype OO.

A child gets one allele from each parent. You are given the phenotype of parent one, the phenotype of parent two, and the phenotype of the child. Return every pair of parent genotypes that could give a child with that phenotype. The order inside a pair matters: parent one comes first.

Write each pair as parentOneGenotype|parentTwoGenotype. Spell each genotype exactly as in the list above. Do not repeat a pair, and sort the result lexicographically (plain dictionary order).

Function

possibleParentGenotypes(parentOnePhenotype: String, parentTwoPhenotype: String, childPhenotype: String) → String[]

Examples

Example 1

parentOnePhenotype = "A"parentTwoPhenotype = "B"childPhenotype = "O"return = ["AO|BO"]

An O child needs an O allele from each parent. So parent one, who has phenotype A, must be AO, and parent two, who has phenotype B, must be BO. The only pair is AO|BO.

Example 2

parentOnePhenotype = "AB"parentTwoPhenotype = "O"childPhenotype = "A"return = ["AB|OO"]

Phenotypes AB and O each have only one genotype, so parent one is AB and parent two is OO. Parent one can pass A and parent two passes O, so the child can be AO, which is phenotype A. The answer is AB|OO.

Constraints

  • Each phenotype is exactly one of A, B, AB, or O.
  • Parent order matters in each returned pair.
  • The model uses only the A, B, and O alleles. It ignores all other blood-group factors.

More Upstart Online Assessment questions

  • Buffet Day GainsOA · Seen Sep 2026
  • Case-Insensitive Anagram CheckOA · Seen Sep 2026
  • Filter Duplicates While Preserving OrderOA · Seen Sep 2026
  • Scale Ingredient QuantitiesOA · Seen Sep 2026
  • Chunked Byte Stream ChecksumsOA · Seen Aug 2026
  • Cluster Size on DiskOA · Seen Aug 2026
  • Double Substitution DecryptionOA · Seen Aug 2026
  • Add Drama to Text GroupsOA · Seen Jul 2026
  • Lexicographic Word FrequenciesOA · Seen Jul 2026
  • Minimum Absolute Pair DifferenceOA · Seen Jul 2026

Similar questions at other companies

  • Cheating CodemakerJane Street · OA
  • Best Poker Category with a JokerScale AI · PHONE SCREEN · ONSITE INTERVIEW
  • Find All Zip Rummy MeldsZip · PHONE SCREEN · ONSITE INTERVIEW
  • Deduplicated Query RegistrationDatadog · ONSITE INTERVIEW
  • Fixed-Range Frequency CountWaymo · PHONE SCREEN
  • Split Tender Part 2 - Expiration DatesStripe · OA
  • Organization Reputation After Employee DeparturesHSBC · OA
  • Bank Accounts with Balance HistoryMeta · OA
  • Count Overlapping Square PairsRamp · OA
  • Find Valid SET Card TriplesSnowflake · OA · PHONE SCREEN
See Upstart hiring insights
Saved
class Solution {
    public String[] possibleParentGenotypes(String parentOnePhenotype, String parentTwoPhenotype, String childPhenotype) {
        // Write your code here.
    }
}
Checking account…