FastPrepDays Between Each User's Latest Two Posts
Problems/Days Between Each User's Latest Two Posts

Days Between Each User's Latest Two Posts

Zip logoZip● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: The report gives the goal of comparing the latest post with the previous one. A minimal schema, a tie rule for equal dates, and counting whole days are our assumptions. Our version is about 94% the same as the reported question.

You are given a users table and a posts table from a forum. For every user who has at least one post, return that user's current post and the number of calendar days since the immediately previous post.

The current post is the user's latest post by creation_date. When dates tie, the larger post_id is later. The previous post is the next row in that same ordering.

Return user_id, display_name, current_creation_date, and days_since_previous_post. A user with exactly one post has a day difference of 0. Users with no posts are omitted.

Order rows by current_creation_date from newest to oldest, then by user_id ascending.

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.

users

ColumnTypeNullableDescription
user_idPKIntegerNo—
display_nameTextNo—

posts

ColumnTypeNullableDescription
post_idPKIntegerNo—
owner_user_idIntegerNo—
creation_dateDateNo—

Foreign key: owner_user_id → users(user_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
user_idIntegerNo—
display_nameTextNo—
current_creation_dateDateNo—
days_since_previous_postIntegerNo—

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

Constraints

  • users.user_id and posts.post_id are unique.
  • Every posts.owner_user_id references an existing user.
  • creation_date is a calendar date.
  • A larger post_id is later when one user's creation dates tie.
  • Users with no posts are omitted; users with one post have a day difference of 0.

More Zip Phone Screen questions

  • Maximum Survival Time in a Graph PursuitPHONE SCREEN · Seen Sep 2026
  • Find All Zip Rummy MeldsPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2026
  • Shortest Path Around Moving ParadesPHONE SCREEN · Seen Mar 2026
  • Furthest Building with Sandbags and RopesPHONE SCREEN · Seen Feb 2026
  • Phrase Covering the Most WordsPHONE SCREEN · Seen Feb 2026
  • Translate Values in a Nested MapPHONE SCREEN · Seen Feb 2026
  • Maximum Nonadjacent Sum in a General TreePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2025
  • Shortest Distance in a GraphPHONE SCREEN · Seen Nov 2025
  • Open the Lock and Return a Shortest PathPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2025
  • Winning Draws for a Mahjong HandPHONE SCREEN · Seen Sep 2025

Similar questions at other companies

  • Nth Highest SalaryPaytm · PHONE SCREENPaytm interview questions
  • Email Funnel: Opened Within a Day, Replied Within a WeekSuperhuman · PHONE SCREENSuperhuman interview questions
  • iPhone Model Sales Share by CountryApple · PHONE SCREENApple interview questions
  • Top Three Accounts by Monthly Transaction AmountMastercard · PHONE SCREENMastercard interview questions
  • In-Memory Database QueriesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Top Three Sales per County and YearClickhouse · PHONE SCREEN
  • Block Type with the Most ChildrenNotion · PHONE SCREENNotion interview questions
  • Third-Highest Known SalaryAdobe · PHONE SCREENAdobe interview questions
  • Observed-User Percentage by AppMicrosoft · PHONE SCREENMicrosoft interview questions
  • Nth-Highest Book Sales VolumeAmazon · PHONE SCREEN

Zip interview experiences

  • ZipHQ New Grad OA and Interview Questions: 11 Experiences
  • Zip SWE Interview Timelines: 31 Experiences (Part 2 of 2)
  • Zip SWE OA and Interview Questions: 31 Experiences (Part 1 of 2)
All Zip interview questionsSee Zip hiring insights