FastPrepClean Up Captions
Problems/Clean Up Captions

Clean Up Captions

TikTok logoTikTok● EasyOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

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."

Function

optimizeStorageByCleaning(for_you: String[], following: String[]) → String[]

Complete the function optimizeStorageByCleaning in the editor.

optimizeStorageByCleaning has the following parameter(s):

  1. String for_you[n]: an array of strings
  2. String 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.

Examples

Example 1

for_you = ["ba", "md", "rj"]following = ["af", "ee", "rf"]return = ["YES", "NO", "YES"]
Example 1 illustration

Constraints

  • All the strings consist of lowercase English letters only, ascii[a-z].
  • |for_you| = |following|

More TikTok interview questions

  • Center of the Largest Perfect X-ShapeOA · Seen Nov 2026
  • Count Subarrays Matching a Comparison PatternOA · Seen Nov 2026
  • Count Suffix Word PairsOA · Seen Nov 2026
  • Minimum Cost of Every K-Capable Model SetOA · Seen Nov 2026
  • Longest Substring Without Repeating CharactersPHONE SCREEN · Seen Oct 2026
  • Next Greater Indices and Maximum GapPHONE SCREEN · Seen Oct 2026
  • Count Subarrays with at Least K Equal-Fruit PairsOA · Seen Oct 2026
  • Shell Command Counts with History ReferencesOA · Seen Oct 2026
  • Product Minus Sum of DigitsOA · Seen Aug 2026
  • Count 2x2 Submatrices by Black CellsOA · Seen Aug 2026

Similar questions at other companies

  • Branch with the Most FilesCapital One · OACapital One interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • First Non-Repeating CharacterAmazon · OA · ONSITE INTERVIEW
  • Total Each Letter's Count in an Encoded StringIBM · OAIBM interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • Count Palindrome Addition ChoicesThe D.E. Shaw Group · OAThe D.E. Shaw Group interview questions
  • Count Palindrome Addition ChoicesHudson River Trading · OAHudson River Trading interview questions
  • Count Phrases Formed by Anagram ReplacementWells Fargo · OAWells Fargo interview questions
  • Count Repeated Request IDs (Data Science OA)McKinsey & Company · OAMcKinsey & Company interview questions

TikTok interview experiences

  • TikTok AI Infra Intern LLM Round 2: 1 Experience
  • TikTok AI Infra Intern DeepSpeed Round: 1 Experience
  • TikTok AI Infra Intern Kernel Round: 1 Experience
  • TikTok AI Infra Intern Interviews, 3 Rounds: 1 Experience
  • TikTok AI Infra Intern Interview Timeline: 1 Experience
  • TikTok AI Infra Intern Onsite Round 2: 1 Experience
All TikTok interview questionsSee TikTok hiring insights
Saved
class Solution {
    public String[] optimizeStorageByCleaning(String[] for_you, String[] following) {
      // write your code here
    }

}
Checking account…