PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Data Manipulation (SQL/Python)/Lyft

Print the K-th non-empty line

Last updated: Mar 29, 2026

Quick Overview

This question evaluates streaming file I/O, memory-efficient data processing, UTF-8 handling, and robustness with edge cases such as blank lines, trailing newlines, and files containing fewer than K non-empty lines, while also requiring reasoning about time and space complexity.

  • Medium
  • Lyft
  • Data Manipulation (SQL/Python)
  • Software Engineer

Print the K-th non-empty line

Company: Lyft

Role: Software Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

Given a large UTF-8 text file, write a program that prints the K-th non-empty line. Do not load the whole file into memory. Specify how you handle files with fewer than K non-empty lines, blank lines, and trailing newline behavior. Provide code in a language of your choice and discuss time and space complexity.

Quick Answer: This question evaluates streaming file I/O, memory-efficient data processing, UTF-8 handling, and robustness with edge cases such as blank lines, trailing newlines, and files containing fewer than K non-empty lines, while also requiring reasoning about time and space complexity.

Related Interview Questions

  • Query and transform marketplace data in SQL/Python - Lyft (Medium)
Lyft logo
Lyft
Sep 6, 2025, 12:00 AM
Software Engineer
Onsite
Data Manipulation (SQL/Python)
7
0

Given a large UTF-8 text file, write a program that prints the K-th non-empty line. Do not load the whole file into memory. Specify how you handle files with fewer than K non-empty lines, blank lines, and trailing newline behavior. Provide code in a language of your choice and discuss time and space complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Lyft•More Software Engineer•Lyft Software Engineer•Lyft Data Manipulation (SQL/Python)•Software Engineer Data Manipulation (SQL/Python)
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.