← Codeium Interview Insights

Codeium·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Codeium software engineer interview with a string manipulation coding problem. Pretty straightforward on the surface but the stable sort requirement is where people probably trip up.

Questions Asked (1)

Q1

Given an array of strings, return the third largest word by length. If two words share the same length, preserve their original order from the input before ranking.

Algorithms & Data Structures
Author's notes

The basic idea clicks fast: sort by length descending, grab index 2.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the ranking rule: sort words by length descending, but for equal lengths, keep original order (stable sort). Then return the third word in the sorted list, handling edge cases like fewer than three words or duplicate lengths.

Pro tip: Mention that you can use a stable sort or a min-heap of size 3 to achieve O(n) time, but always confirm the expected time/space complexity with the interviewer.

1. Clarify requirements and edge cases

Ask about empty input, fewer than three words, and whether 'third largest' means third distinct length or third word. Confirm that ties preserve original order.

2. Choose an algorithm

Decide between sorting (O(n log n)) or a min-heap of size 3 (O(n)). Explain the trade-offs and pick based on constraints.

3. Implement with stable ordering

If sorting, use a stable sort (e.g., Python's sorted with key=len, reverse=True). If using a heap, store (length, index) to break ties by original order.

4. Handle edge cases

Return null or an empty string if there are fewer than three words. Ensure the third element is correctly identified after sorting.

5. Test and verify

Walk through examples, including ties and duplicates, to confirm the output matches the expected third largest word.

Key Points to Mention

  • Stable sorting to preserve original order for equal lengths
  • Time and space complexity trade-offs between sorting and heap
  • Edge cases: fewer than three words, empty input, all same length
  • Definition of 'third largest' (third word vs. third distinct length)
  • Using index as a tie-breaker in heap-based approach
  • Potential follow-up: what if the array is very large or streamed?

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