← Disney Interview Insights

Disney·Data Scientist·Online Assessment (OA)·Intermediate

Intermediate
Jun 2026

Summary

Disney data scientist coding round, three questions back to back. Nothing too wild but the last one tripped me up a bit.

Questions Asked (3)

Q1

Given two 2D integer arrays of the same dimensions, return a new matrix where each element is the sum of the corresponding elements from the two input arrays.

Algorithms & Data Structures
Author's notes

Straightforward.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (e.g., matrix dimensions, data types, in-place vs. new matrix) and then walk through a straightforward element-wise addition approach. Discuss time and space complexity, and mention potential optimizations or edge cases such as empty matrices or non-integer values.

Pro tip: Demonstrate awareness of real-world data science scenarios by relating matrix addition to common operations like combining feature matrices or aggregating results from parallel computations. This shows you understand the practical relevance beyond the algorithmic exercise.

1. Clarify requirements

Ask about input constraints: Are the matrices guaranteed to be the same dimensions? What data types? Should the result be a new matrix or can it be in-place? Are there any memory or performance constraints?

2. Outline the algorithm

Describe a simple nested loop approach: iterate over each row and column, compute the sum of corresponding elements, and store in a new matrix. Mention that this is O(m*n) time and space.

3. Discuss edge cases

Consider empty matrices, matrices with zero rows or columns, and potential integer overflow if using fixed-size types. Also mention handling of non-integer types if applicable.

4. Consider optimizations

If performance is critical, discuss vectorization (e.g., using NumPy) or parallelization. For in-place addition, note that it saves space but modifies input.

5. Provide code or pseudocode

Write clear pseudocode or actual code (e.g., in Python) to demonstrate the solution. Ensure it handles the general case and is readable.

Key Points to Mention

  • Time complexity: O(m*n) where m and n are dimensions
  • Space complexity: O(m*n) for the output matrix (or O(1) if in-place)
  • Edge cases: empty matrices, mismatched dimensions (if not guaranteed), integer overflow
  • Use of vectorized operations (e.g., NumPy) for efficiency in data science contexts
  • In-place vs. new matrix trade-offs
  • Potential for parallelization or GPU acceleration for large matrices

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Given a list of strings, return a map of each unique string to the number of times it appears in the list.

Algorithms & Data Structures
Author's notes

Warmup-level stuff.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: confirm the input is a list of strings and the output should be a dictionary mapping each unique string to its count. Then, discuss a straightforward solution using a hash map (dictionary) to iterate through the list and tally occurrences, emphasizing time and space complexity. Finally, mention potential edge cases and how you would handle them.

Pro tip: In a data science context, relate this to real-world scenarios like counting word frequencies in text data or analyzing user behavior logs, showing you understand the practical applications beyond just coding.

1. Clarify requirements

Ask clarifying questions to ensure you understand the input (e.g., list of strings, possible empty strings, case sensitivity) and output format (e.g., dictionary, order of keys).

2. Outline approach

Explain that you will use a hash map (dictionary) to store counts, iterating through the list once and incrementing the count for each string.

3. Discuss complexity

State that the time complexity is O(n) and space complexity is O(k), where n is the number of strings and k is the number of unique strings.

4. Handle edge cases

Mention how you would handle empty list, empty strings, case sensitivity, and potential memory constraints for large datasets.

5. Provide code or pseudocode

Write clean, efficient code (e.g., in Python) using a dictionary or collections.Counter, and explain each step.

Key Points to Mention

  • Use of hash map/dictionary for O(1) average-case lookup and insertion
  • Time complexity O(n) and space complexity O(k)
  • Edge cases: empty list, empty strings, case sensitivity, non-string inputs
  • Alternative approaches: collections.Counter in Python, sorting and counting (O(n log n))
  • Real-world applications: word frequency, log analysis, feature engineering
  • Scalability considerations for large datasets (e.g., streaming, distributed counting)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Given an array of integers (possibly with duplicates and negatives), find the length of the longest sequence of consecutive integers that can be formed from the array elements. Aim for O(n) time.

Algorithms & Data Structures
Author's notes

This is the classic hash set version of the problem and I knew it, but I fumbled the duplicate handling for a minute.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a hash set to store all unique numbers, then for each number check if it is the start of a sequence (i.e., num-1 not in set) and count the length of the consecutive run. This yields O(n) time because each number is visited at most twice.

Pro tip: Mention that sorting would be O(n log n) and is not optimal; the hash set approach achieves O(n) by only expanding sequences from their start. Also, clarify that duplicates are naturally handled by the set.

1. Clarify the problem

Confirm that the sequence must consist of consecutive integers (e.g., 3,4,5) and that the array can have duplicates and negatives. Ask if the sequence needs to be contiguous in the original array (it does not; it's about values).

2. Consider naive approaches

Discuss sorting the array (O(n log n)) and then scanning for consecutive runs, but note it doesn't meet O(n) requirement. Mention brute force O(n^2) or O(n^3) approaches as baselines.

3. Propose optimal hash set solution

Insert all elements into a hash set. Then iterate through the set; for each number, check if it's the start of a sequence (num-1 not in set). If so, count consecutive numbers by incrementing and checking membership.

4. Analyze time and space complexity

Explain that each number is inserted once and checked at most twice (once as a potential start, once as part of a sequence), giving O(n) time. Space is O(n) for the set.

5. Handle edge cases and test

Consider empty array, single element, all duplicates, and negative numbers. Walk through a small example to verify correctness.

Key Points to Mention

  • Hash set for O(1) lookups
  • Only start counting from the beginning of a sequence (num-1 not in set)
  • Time complexity O(n) because each element is visited at most twice
  • Space complexity O(n) due to the set
  • Comparison with sorting approach (O(n log n))
  • Handling duplicates and negatives naturally

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.