Find Tweets Whose Character Count Exceeds Fifteen

Quick Overview

Return IDs for tweets that exceed 15 characters, counting spaces and exclamation marks.

Find Tweets Whose Character Count Exceeds Fifteen

Company: Google

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

### Problem Return tweet_id for Tweets rows whose content uses more than 15 characters. A tweet with exactly 15 characters does not qualify. Preserve the source content alphabet of alphanumeric characters, exclamation marks and spaces. Row order is unrestricted. ### Tables Table: `Tweets` ```text +----------------+---------+ | Column Name | Type | +----------------+---------+ | tweet_id | int | | content | varchar | +----------------+---------+ tweet_id is the primary key (column with unique values) for this table. content consists of alphanumeric characters, '!', or ' ' and no other special characters. This table contains all the tweets in a social media app. ``` ### Example ```text Tweets (tweet_id,content): (1,"123456789012345"), (2,"123456789012345!") Output (tweet_id): (2) The two lengths are 15 and 16 respectively. ``` ### What a Strong Answer Covers - Count characters in each tweet, including permitted spaces and exclamation marks. - Return only the IDs strictly above the limit. ### Follow-up Questions - How would the answer change if the limit were expressed in UTF-8 bytes? - How would you report the number of characters each invalid tweet exceeds the limit by?

Overview: Return IDs for tweets that exceed 15 characters, counting spaces and exclamation marks.

Google logo
Google
easySoftware EngineerOtherData Manipulation (SQL/Python)
0
0

Problem

Return tweet_id for Tweets rows whose content uses more than 15 characters. A tweet with exactly 15 characters does not qualify. Preserve the source content alphabet of alphanumeric characters, exclamation marks and spaces. Row order is unrestricted.

Tables

Table: Tweets

+----------------+---------+
| Column Name    | Type    |
+----------------+---------+
| tweet_id       | int     |
| content        | varchar |
+----------------+---------+
tweet_id is the primary key (column with unique values) for this table.
content consists of alphanumeric characters, '!', or ' ' and no other special characters.
This table contains all the tweets in a social media app.

Example

Tweets (tweet_id,content): (1,"123456789012345"), (2,"123456789012345!")
Output (tweet_id): (2)
The two lengths are 15 and 16 respectively.

What a Strong Answer Covers Guidance

  • Count characters in each tweet, including permitted spaces and exclamation marks.
  • Return only the IDs strictly above the limit.

Follow-up Questions Guidance

  • How would the answer change if the limit were expressed in UTF-8 bytes?
  • How would you report the number of characters each invalid tweet exceeds the limit by?