Clean Up Captions
As a TikTok developer, you're working on a project to clean up captions and optimize storage. With millions of captions and hashtags circulating the platform, your task is to detect any overlap between captions on the for_you feed and the following feed. But it's not just about finding common words or hashtags; you need to identify any common substring between the two!
You are given two lists of captions — one from the for_you feed and another from the following feed. For each corresponding pair of captions, your job is to check if any substring appears in both captions. If a common substring is found, you should output "YES"; otherwise, output "NO."
Complete the function optimizeStorageByCleaning in the editor.
optimizeStorageByCleaning has the following parameter(s):
String for_you[n]: an array of stringsString following[n]: an array of strings
Returns
String answers[n]: An array of strings where each element is either "YES" or "NO". "YES" indicates that a common substring exists between the corresponding logs in for_you and following, while "NO" indicates that no common substring exists.
1Example 1

Constraints
Limits and guarantees your solution can rely on.
- All the strings consist of lowercase English letters only, ascii[a-z].
- |for_you| = |following|