Skip to main content
Back to problems
Leetcode
Easy
Strings
Invalid Tweets

Filter tweet records and return the ids of tweets whose text is longer than 15 characters.

Acceptance 50%
Problem Statement

Problem

You are given a table of tweets. Each record contains an id and the tweet content.

A tweet is considered invalid if the number of characters in content is strictly greater than 15.

Return the id values of all invalid tweets.

The result can be returned in any order unless otherwise specified by the platform.

Notes

  • Count characters exactly as they appear in the string.
  • Do not modify the tweet text; only identify which records are invalid.

Input Format

  • A list/table of tweet records.
  • Each record contains:
    • id: integer
    • content: string

Output Format

  • A list of id values for tweets whose content length is greater than 15.

Constraints

  • 1 <= number of tweets <= 1000 or similar table-sized input.
  • Tweet content is non-empty.
  • Compare length using a strict > 15 condition.
Examples
Sample cases returned by the problem API.

Example 1

Input

Tweets table:
+----+-------------------------+
| id | content                 |
+----+-------------------------+
| 1  | Vote for Pedro          |
| 2  | Come to my party        |
| 3  | This tweet is too long  |
+----+-------------------------+

Output

+----+
| id |
+----+
| 3  |
+----+

Explanation

Only the third tweet has content longer than 15 characters.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.