Variadic Function Library Matches
Reported by candidates from IBM's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The constraint that kills brute force in this IBM OA, reported September 2026, is the 300000 total token cap across up to 100000 functions. You can't do anything clever per pair of function and query. Each function gets one linear pass over its own tokens and you're done. It's a matching problem dressed up as API design: fixed prefix, optional repeating tail. If you blank on the edge cases, StealthCoder runs invisibly on the live OA as a safety net. The logic itself is short once you see it.
The problem
A function library registers functions in order. Function i has name names[i], declared parameter types parameterTypes[i], and flag isVariadic[i]. A non-variadic function matches a query only when its declared types equal the query exactly. A variadic declaration must be non-empty: every declared type before the last is a fixed prefix, and the final declared type accepts zero or more query arguments. Type tokens compare by exact case-sensitive equality. Return the names of every matching function in registration order. Function findFunctionMatches(names: String[], parameterTypes: String[][], isVariadic: boolean[], queryTypes: String[]) → String[] Examples Example 1 names = ["foo","bar","baz"] parameterTypes = [["String"],["String","Integer"],["String","Integer"]] isVariadic = [false,true,false] queryTypes = ["String"] return = ["foo","bar"] The variadic final Integer consumes zero arguments, while the fixed two-parameter function does not match. Example 2 names = ["join","pair"] parameterTypes = [["String","String"],["String","String"]] isVariadic = [true,false] queryTypes = ["String","String","String"] return = ["join"] The final type of join repeats to consume both trailing arguments. Example 3 names = ["sum"] parameterTypes = [["Integer"]] isVariadic = [true] queryTypes = [] return = ["sum"] A declaration consisting only of its variadic type accepts an empty query. Constraints names.length == parameterTypes.length == isVariadic.length. 0 <= names.length <= 100000. The total number of declared and query type tokens is at most 300000. Names and type tokens are non-empty ASCII strings of length at most 100. Every variadic declaration contains at least one type.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is that every function is checked independently, and each check costs at most the length of its own declaration plus a bounded scan of the query. Non-variadic: lengths must be equal and every token must match. Variadic: take prefix = declared[0..k-2] and tail = declared[k-1]. The query needs at least k-1 tokens, the first k-1 must equal the prefix, and every remaining query token must equal tail. Zero remaining tokens is fine, which is Example 1 and Example 3. The pitfall is a variadic declaration of one type against an empty query, and wrongly requiring at least one tail argument. Also fail fast on the length check before comparing, so you never scan a long query against a short function. Total work is bounded by the token budget. Keep output in registration order by looping in index order. If you freeze on the tail-scan logic during the live OA, StealthCoder is the hedge.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Variadic Function Library Matches cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass IBM's OA.
IBM reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Variadic Function Library Matches FAQ
What's the trick in Variadic Function Library Matches?+
Split a variadic declaration into a fixed prefix and a repeating last type. Match the prefix exactly against the first query tokens, then require every leftover query token to equal the last type. Zero leftovers is valid. Non-variadic is just exact equality of both lists.
Why doesn't brute force work here?+
It does if you mean one pass per function. What fails is anything that re-scans the query heavily or builds expensive structures per function. With 100000 functions and 300000 total tokens, keep each check linear in its own declaration and bail out early on length mismatch.
What edge cases should I test before submitting?+
Empty query with a single-type variadic declaration, which must match. Empty query with a non-variadic empty-looking case isn't possible since variadic is non-empty, but test zero functions. Also test case sensitivity, like String versus string, and a query shorter than the fixed prefix.
Is this pattern still asked at IBM?+
This one was reported in September 2026, so it's current. It's a string and array matching problem with a small twist, the kind of simulation-style question that shows up in OAs. Expect similar rule-based matching rather than heavy algorithms.
How do I prepare in 48 hours?+
Write the matcher once from scratch: length check, prefix compare, tail loop. Run all three examples by hand. Then practice reading constraints and deciding what complexity they allow. If you still blank during the OA, StealthCoder can cover you, but the logic is learnable in an evening.