Tap here to switch tabs
Problem
Submissions

Problem: Make Number of Distinct Characters Equal

Make Number of Distinct Characters Equal asks whether one character swap between two strings can make them contain the same number of distinct characters, returning true or false.

Statement

You are given two 00 indexed strings, word1 and word2.

A move consists of selecting two indices, ii and jj, such that 0≤i<0 \leq i < word1.length and 0≤j<0 \leq j < word2.length, and swapping the character word1[i] with the character word2[j].

Return true if it is possible to make the number of distinct characters in word1 and word2 equal after applying exactly one move, and false otherwise.

Constraints:

  • 1≤1 \leq word1.length, word2.length ≤105\leq 10^5

  • word1 and word2 consist of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make Number of Distinct Characters Equal

Make Number of Distinct Characters Equal asks whether one character swap between two strings can make them contain the same number of distinct characters, returning true or false.

Statement

You are given two 00 indexed strings, word1 and word2.

A move consists of selecting two indices, ii and jj, such that 0≤i<0 \leq i < word1.length and 0≤j<0 \leq j < word2.length, and swapping the character word1[i] with the character word2[j].

Return true if it is possible to make the number of distinct characters in word1 and word2 equal after applying exactly one move, and false otherwise.

Constraints:

  • 1≤1 \leq word1.length, word2.length ≤105\leq 10^5

  • word1 and word2 consist of only lowercase English letters.