2068. Check Whether Two Strings are Almost Equivalent
2022-01-20 14:39 作者:您是打尖兒還是住店呢 | 我要投稿
Two strings?word1
?and?word2
?are considered?almost equivalent?if the differences between the frequencies of each letter from?'a'
?to?'z'
?between?word1
?and?word2
?is?at most?3
.
Given two strings?word1
?and?word2
, each of length?n
, return?true
?if?word1
?and?word2
?are?almost equivalent, or?false
?otherwise.
The?frequency?of a letter?x
?is the number of times it occurs in the string.
?
Runtime:?2 ms, faster than?52.71%?of?Java?online submissions for?Check Whether Two Strings are Almost Equivalent.
Memory Usage:?38.9 MB, less than?37.32%?of?Java?online submissions for?Check Whether Two Strings are Almost Equivalent.
標(biāo)簽: