Skip to content
DeepForgeby svx
All problems
MediumNLPnlp-345

Longest Common Suffix Length

Problem

The longest common suffix length counts trailing characters shared by two strings.

Given the two strings, return the length.

Hint

Compare the strings from the end.

Test cases

case 1
in: ["walking","talking"]
expected: 6
case 2
in: ["abc","xyz"]
expected: 0
case 3
in: ["data","meta"]
expected: 2
Starter codePython
def longest_common_suffix_length(a, b):
    # Your code here
    pass

3 test cases · run your code against them in the editor