FastPrepApply Overridden Integer Transforms
Problems/Apply Overridden Integer Transforms

Apply Overridden Integer Transforms

Optimus Information logoOptimus Information● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Optimus Information onsite interview for interns. The report asks to implement function overriding. We chose a base increment transform and a derived square transform, the smallest choices with a fixed outcome.

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

A base transformer returns x + 1. A derived transformer overrides the same method and returns x * x. For each value, kinds[i] is B or D and selects the runtime object behind a base reference.

Return every transformed value in order.

Function

applyTransforms(values: int[], kinds: String[]) → long[]

Examples

Example 1

values = [2,3,-4]kinds = ["B","D","D"]return = [3,9,16]

The base object increments while derived objects square.

Example 2

values = []kinds = []return = []

Empty input produces empty output.

Constraints

  • values.length == kinds.length.
  • 0 <= values.length <= 100000.
  • |values[i]| <= 1000000000.

Source note: Author-written prompt excerpt retained for source fidelity.

More Optimus Information Onsite Interview questions

  • 3SumONSITE INTERVIEW · Seen Oct 2026
  • Compute Areas Through an Abstract Shape TypeONSITE INTERVIEW · Seen Oct 2026
  • Dispatch Virtual Shipping PricesONSITE INTERVIEW · Seen Oct 2026
  • N-Queens Solution CountONSITE INTERVIEW · Seen Oct 2026
  • Two SumONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Ring Buffer OperationsAmazon · ONSITE INTERVIEW
  • Recent Hit CounterAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • Random Dasher Set OperationsDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Path Leaf Character IteratorGoogle · ONSITE INTERVIEWGoogle interview questions
  • Randomized Collection with Duplicate ValuesOkta · ONSITE INTERVIEWOkta interview questions
  • Escape Room LeaderboardPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
  • Implement MallocNVIDIA · ONSITE INTERVIEWNVIDIA interview questions
  • Removal PoolCitadel · ONSITE INTERVIEWCitadel interview questions
  • Circuit Breaker State MachineWise · ONSITE INTERVIEW
  • Hybrid Run-Length and Bit-Packing EncoderDatabricks · ONSITE INTERVIEWDatabricks interview questions
All Optimus Information interview questionsSee Optimus Information hiring insights
Saved
class Solution {
    public long[] applyTransforms(int[] values, String[] kinds) {
        // Write your code here.
    }
}
Checking account…