FastPrepFastPrep
Problem Brief

Max Distance

OA
See Google online assessment and hiring insights

The distance between 2 binary strings is the sum of their lengths after removing the common prefix.

Given a list of binary strings, pick a pair that gives you maximum distance among all possible pairs and return that distance.

1Example 1

Input
binaryStrings = ["1011000", "1011110"]
Output
6
Explanation
The common prefix for these two numbers is 1011, so the distance is len("000") + len("110") = 3 + 3 = 6.

Constraints

Limits and guarantees your solution can rely on.

Unknown yet. If you happen to know about it, feel free to lmk! TYSM ~3~
public int maxDistance(List<String> binaryStrings) {
    // write your code here
}
Input

binaryStrings

["1011000", "1011110"]

Output

6

Sign in to submit your solution.