FastPrepCount String Pairs With Disjoint Characters
Problems/Count String Pairs With Disjoint Characters

Count String Pairs With Disjoint Characters

Netflix logoNetflix● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Netflix phone screen for a full-time role. The report leaves out how a pair is identified, the alphabet, what happens with empty strings, and the number limits. We filled those in.

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

Given an array of strings words, return the number of unordered index pairs (i, j) such that i < j and the two strings share no character.

For this exercise, assume every array index is a distinct candidate, even when two strings have equal values. Every string contains only lowercase English letters and may be empty. An empty string shares no character with any string.

Function

countDisjointCharacterPairs(words: String[]) → int

Examples

Example 1

words = ["abc","def","ad","xyz"]return = 4

The valid pairs are (0,1), (0,3), (1,3), and (2,3).

Example 2

words = ["a","a","b",""]return = 5

The two equal a values occupy different indices. Each pairs with b and the empty string, while b also pairs with the empty string.

Example 3

words = []return = 0

An empty array contains no index pair.

Constraints

  • 0 <= words.length <= 5000
  • 0 <= sum(words[i].length) <= 200000
  • Every string contains only lowercase English letters and may be empty.
  • Each array index is counted as a distinct candidate.

More Netflix interview questions

  • Timed Cache with Sidecar CleanupPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Repeated Titles in Viewing HistoryPHONE SCREEN · Seen Sep 2026
  • Capacity-Limited Timed CachePHONE SCREEN · Seen Sep 2026
  • Custom Record and Free-Form Field ParserPHONE SCREEN · Seen Sep 2026
  • Dynamic Broadcast TimesPHONE SCREEN · Seen Aug 2026
  • Deduplicate Homepage Content Across RowsPHONE SCREEN · Seen Aug 2026
  • Longest Consecutive Identical Character RunPHONE SCREEN · Seen Aug 2026
  • Longest Substring Without Repeating CharactersPHONE SCREEN · Seen Aug 2026
  • Topological Sort for Ads TasksPHONE SCREEN · Seen Jun 2026
  • Score-Rotating Movie PlaylistONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
  • Ordered IP FirewallDatabricks · PHONE SCREENDatabricks interview questions
  • Count One-Swap Number PairsCapital One · OACapital One interview questions
  • Maximum Unique-Character Word SubsetMeta · ONSITE INTERVIEWMeta interview questions
  • Cheating CodemakerJane Street · OAJane Street interview questions
  • Count Legal Outfit CombinationsDuolingo · OADuolingo interview questions
  • Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
  • Palindrome-Rearrangeable PairsExpedia · OAExpedia interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions

Netflix interview experiences

  • Netflix interviews · 2026
All Netflix interview questionsSee Netflix hiring insights
Saved
class Solution {
    public int countDisjointCharacterPairs(String[] words) {
      // write your code here
    }
}
Checking account…