PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates proficiency in parsing and filtering structured data by interpreting Unix-like permission strings and extracting filenames based on permission semantics.

  • nan
  • Jump Trading
  • Coding & Algorithms
  • Software Engineer

Identify read-only files from permission records

Company: Jump Trading

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: nan

Interview Round: Take-home Project

You are given a list of file metadata records. Each record contains: - `owner` (string): the username who owns the file - `permission` (string): a Unix-like permission string of length 9, representing `owner/group/others` permissions in order, e.g. `rwxr-xr--` - `filename` (string) A file is considered **read-only** if **no user category has write permission**, i.e., the permission string contains **no `w`** character anywhere. ### Task Return the list of `filename`s that are read-only. ### Input format (one possible representation) - An array/list of records, where each record is a tuple/object: `{ owner, permission, filename }`. ### Output - An array/list of filenames (strings) that are read-only. ### Notes / assumptions - `permission` is always exactly 9 characters and consists only of `r`, `w`, `x`, and `-`. - Filenames are unique. ### Example Input records: 1. `{owner: "alice", permission: "r--r--r--", filename: "a.txt"}` 2. `{owner: "bob", permission: "rw-r--r--", filename: "b.txt"}` 3. `{owner: "carl", permission: "r-xr-xr-x", filename: "c.sh"}` Output: - `["a.txt", "c.sh"]`

Quick Answer: This question evaluates proficiency in parsing and filtering structured data by interpreting Unix-like permission strings and extracting filenames based on permission semantics.

You are given a list of file metadata records. In this problem, each record is represented as a 3-tuple: (owner, permission, filename). A file is considered read-only if its Unix-like permission string contains no 'w' character anywhere, meaning owner, group, and others all lack write permission. Return the filenames of all read-only files in the same order they appear in the input.

Constraints

  • 0 <= len(records) <= 100000
  • Each record is a tuple (owner, permission, filename)
  • permission is exactly 9 characters long and contains only 'r', 'w', 'x', and '-'
  • Filenames are unique

Examples

Input: ([('alice', 'r--r--r--', 'a.txt'), ('bob', 'rw-r--r--', 'b.txt'), ('carl', 'r-xr-xr-x', 'c.sh')],)

Expected Output: ['a.txt', 'c.sh']

Explanation: a.txt and c.sh have no 'w' in their permission strings, while b.txt does.

Input: ([],)

Expected Output: []

Explanation: An empty input list produces an empty output list.

Input: ([('zoe', '---------', 'empty.bin')],)

Expected Output: ['empty.bin']

Explanation: The permission string contains no write permission at all, so the file is read-only.

Input: ([('dana', 'r-xrw-r--', 'group.txt'), ('erin', 'r-xr-xrwx', 'other.txt'), ('fran', 'rwxr-xr-x', 'owner.txt')],)

Expected Output: []

Explanation: Each file has at least one 'w' somewhere in the permission string, so none are read-only.

Input: ([('gina', 'r--r--r--', 'notes.md'), ('harry', 'r-xr-xr-x', 'run.sh'), ('ivy', 'r--rw-r--', 'draft.txt'), ('jack', '---------', 'hidden')],)

Expected Output: ['notes.md', 'run.sh', 'hidden']

Explanation: notes.md, run.sh, and hidden contain no 'w'. draft.txt has write permission in the group section.

Hints

  1. You do not need to analyze owner, group, and others separately if all you care about is whether write permission exists anywhere.
  2. A single pass through the records is enough: if 'w' is not in the permission string, add the filename to the answer.
Last updated: Apr 29, 2026

Loading coding console...

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.

Related Coding Questions

  • Solve stock trading with pattern rules - Jump Trading (Medium)
  • Solve stock-pattern trading and substring elimination - Jump Trading (Medium)
  • Explain C++ vector, unordered_map, and virtual functions - Jump Trading (Medium)