Tap here to switch tabs
Problem
Submissions

Problem: Check Whether Two Strings are Almost Equivalent

Check Whether Two Strings are Almost Equivalent compares two equal-length strings and returns whether every letter's frequency differs by no more than three.

Statement

Two strings word1 and word2 are considered almost equivalent if the absolute difference between the frequencies of every character from 'a' to 'z' in word1 and word2 is at most 33.

Given two strings word1 and word2, return true if word1 and word2 are almost equivalent, or false otherwise.

Constraints:

  • n ==== word1.length ==== word2.length

  • 1≤1 \leq n ≤100\leq 100

  • word1 and word2 consist only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check Whether Two Strings are Almost Equivalent

Check Whether Two Strings are Almost Equivalent compares two equal-length strings and returns whether every letter's frequency differs by no more than three.

Statement

Two strings word1 and word2 are considered almost equivalent if the absolute difference between the frequencies of every character from 'a' to 'z' in word1 and word2 is at most 33.

Given two strings word1 and word2, return true if word1 and word2 are almost equivalent, or false otherwise.

Constraints:

  • n ==== word1.length ==== word2.length

  • 1≤1 \leq n ≤100\leq 100

  • word1 and word2 consist only of lowercase English letters.