FastPrepGenerate Proteins from Contiguous Named Sequences
Problems/Generate Proteins from Contiguous Named Sequences

Generate Proteins from Contiguous Named Sequences

Benchling logoBenchling● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Benchling full-time phone screen. We follow the exercise in the report. The report leaves out some input limits and some interface details. We chose those. Our version is about 95% the same as the reported question.

Given sequenceNames, ranges, recipes and proteinNames, return every valid protein in recipe order as name:start:end.

Sequence sequenceNames[i] covers the half-open interval ranges[i], written [start,end): it includes start but not end. Recipe recipes[i] lists sequence names in order and makes protein proteinNames[i].

A recipe is valid when it is not empty, uses only known sequence names, and every sequence starts exactly where the previous one ends. Skip any recipe that is not valid.

For a valid recipe, name is its protein name, start is the start of its first sequence, and end is the end of its last sequence.

Function

generateNamedProteins(sequenceNames: String[], ranges: int[][], recipes: String[][], proteinNames: String[]) → String[]

Examples

Example 1

sequenceNames = ["AC","BC","PQ","XY","AB","BT"]ranges = [[5,15],[3,20],[15,22],[22,35],[20,32],[9,13]]recipes = [["AC","PQ"],["AC","PQ","XY"],["BC","AB"],["BT","AC"]]proteinNames = ["P1","P2","P3","P4"]return = ["P1:5:22","P2:5:35","P3:3:32"]

The first three recipes join with no gaps, so their proteins are returned. The fourth is skipped because BT ends at 13 but AC starts at 5.

Constraints

  • Names are unique.
  • sequenceNames.length == ranges.length.
  • recipes.length == proteinNames.length.
  • All interval bounds are non-negative and each start is smaller than its end.

More Benchling interview questions

  • Bounded HTTP Retry FlowPHONE SCREEN · Seen Nov 2025
  • Future-Aware Cache EvictionPHONE SCREEN · Seen Aug 2025
  • Generate All Contiguous Protein ChainsPHONE SCREEN · Seen Jul 2024
  • Eight-Direction Keyboard Typing TimePHONE SCREEN · Seen Apr 2022
  • Next Palindrome NumberPHONE SCREEN · Seen Jul 2021
  • Apply Overlapping HTML Formatting RangesPHONE SCREEN · Seen Feb 2019
  • Validate Nested JSON Against a SchemaONSITE INTERVIEW · Seen Dec 2025
  • Degenerate DNA Substring SearchONSITE INTERVIEW · Seen Jun 2024
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Jul 2021
  • 2048 Move SimulatorOA · Seen Feb 2019

Similar questions at other companies

  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Filter, Sort, and Deduplicate Scheduled TasksRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Merchant Matching, Parts 1–2: Shared Fields and Weighted ThresholdsStripe · PHONE SCREENStripe interview questions
  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN
  • Insert Delete GetRandom O(1)Charta Health · PHONE SCREENCharta Health interview questions
  • Longest Consecutive SequenceKotak Mahindra Bank · PHONE SCREENKotak Mahindra Bank interview questions
  • Longest Consecutive SequenceJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
  • Logger Rate Limiter with Every-Arrival HistoryGoogle · PHONE SCREENGoogle interview questions
  • Propagating Fraud DetectorAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
  • Top K Frequent Elements with a Recency TiebreakSwiggy · PHONE SCREEN
All Benchling interview questionsSee Benchling hiring insights
Saved
class Solution {
    public String[] generateNamedProteins(String[] sequenceNames, int[][] ranges, String[][] recipes, String[] proteinNames) {
        // Write your code here.
    }
}
Checking account…