Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-326

Character Bigram Set Size

Problem

The set of character bigrams captures character-level overlap robust to word order.

Given text, return the number of distinct length-2 substrings.

Hint

Use a set to deduplicate the bigrams.

Test cases

case 1
in: ["abab"]
expected: 2
case 2
in: ["abc"]
expected: 2
case 3
in: ["aa"]
expected: 1
Starter codePython
def character_bigram_set_size(text):
    # Your code here
    pass

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