FastPrepNew-User Devices That Opened an App

New-User Devices That Opened an App

Microsoft logoMicrosoft● EasyFULLTIMEONSITE INTERVIEW

Problem statement

Tables app_opens and device_users describe application activity and whether each known device belongs to a new user.

Return one row containing the number of distinct known new-user devices with at least one activity row whose open_count is positive.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

app_opens

ColumnTypeNullableDescription
device_idTextNo—
app_nameTextNo—
open_countIntegerNo—

device_users

ColumnTypeNullableDescription
device_idTextNo—
is_newBooleanNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
new_device_countIntegerNo—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • A device can appear in multiple app_opens rows and must be counted once.
  • Rows with open_count = 0 do not qualify.
  • Activity for a device absent from device_users does not qualify.
  • Always return one row, including a zero count.

More Microsoft problems

See Microsoft hiring insights