Skip to content

Practice Display the First Three Rows

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2879
LeetCode Problem

Display the First Three Rows

Problem Statement

The employees DataFrame has employee_id (int), name (object), department (object) and salary (int) columns. Return its first three rows in their existing order.

Source: Display the First Three Rows on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
DataFrame employees +-------------+-----------+-----------------------+--------+ | employee_id | name      | department            | salary | +-------------+-----------+-----------------------+--------+ | 3           | Bob       | Operations            | 48675  | | 90          | Alice     | Sales                 | 11096  | | 9           | Tatiana   | Engineering           | 33805  | | 60          | Annabelle | InformationTechnology | 37678  | | 49          | Jonathan  | HumanResources        | 23793  | | 43          | Khaled    | Administration        | 40454  | +-------------+-----------+-----------------------+--------+
Output
+-------------+---------+-------------+--------+ | employee_id | name    | department  | salary | +-------------+---------+-------------+--------+ | 3           | Bob     | Operations  | 48675  | | 90          | Alice   | Sales       | 11096  | | 9           | Tatiana | Engineering | 33805  | +-------------+---------+-------------+--------+

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.