Tap here to switch tabs
Problem
Submissions

Problem: Maximum Distance Between Unequal Words in Array I

Try to solve the Maximum Distance Between Unequal Words in Array I problem.

Statement

You are given an array of strings words.

The distance between two indices i and j (where i ≤\leq j) is defined as j −- i ++ 11.

Return the maximum distance between two indices i and j such that words[i] ≠\neq words[j]. If no two unequal words exist, return 00.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤10\leq 10

  • words[i] consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Distance Between Unequal Words in Array I

Try to solve the Maximum Distance Between Unequal Words in Array I problem.

Statement

You are given an array of strings words.

The distance between two indices i and j (where i ≤\leq j) is defined as j −- i ++ 11.

Return the maximum distance between two indices i and j such that words[i] ≠\neq words[j]. If no two unequal words exist, return 00.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤10\leq 10

  • words[i] consists of lowercase English letters.