← Atlassian Interview InsightsMachine Learning Engineer

Atlassian·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Atlassian ML Engineer interview had at least one coding round with a classic string manipulation problem. Nothing too wild but it's the kind of question that feels easy until you're actually writing it out under pressure.

Questions Asked (1)

Q1

Given a secret number and a guess, return a hint string showing how many digits are correct in both value and position (bulls) and how many digits appear in the secret but are in the wrong position (cows). Format the result as 'xAyB'.

Algorithms & Data Structures
Author's notes

My first instinct was to just loop through and count matches, which gets you the bulls fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (e.g., digit length, leading zeros, duplicates) and then walk through a two-pass algorithm: first count bulls by comparing digits at the same index, then count cows using frequency maps for the remaining digits. Emphasize time and space complexity and discuss edge cases like repeated digits.

Pro tip: Mention that you would handle duplicates carefully by decrementing counts only for non-bull digits, and note that the solution runs in O(n) time with O(1) extra space since digits are limited to 0-9.

1. Clarify requirements and constraints

Ask about input format (strings vs integers), length limits, leading zeros, and whether digits can repeat. Confirm the output format 'xAyB'.

2. Count bulls in a first pass

Iterate through both strings simultaneously and increment bulls when digits match at the same position. Mark or skip these positions for the next step.

3. Count cows using frequency maps

Build frequency maps of the remaining digits from secret and guess (excluding bulls). For each digit in the guess map, add the minimum of its count and the secret's count to cows.

4. Format and return the result

Construct the string as bulls + 'A' + cows + 'B' and return it. Double-check the order (bulls first, then cows).

5. Analyze complexity and edge cases

State that the algorithm runs in O(n) time and O(1) space (since digits are 0-9). Discuss edge cases like all bulls, no matches, and repeated digits.

Key Points to Mention

  • Two-pass approach: first count bulls, then count cows from remaining digits
  • Use frequency arrays/maps of size 10 for digits 0-9 to achieve O(1) space
  • Handle duplicate digits correctly by taking the minimum count between secret and guess for each digit
  • Time complexity O(n) and space complexity O(1)
  • Edge cases: leading zeros, all bulls, no matches, repeated digits
  • Clear variable naming and modular code structure for readability

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