Skip to content

ItsEricSun/codesignal-industry-coding-practice

Repository files navigation

Industry Coding Practice Framework

This project simulates a CodeSignal Industry Coding Framework assessment. It contains four progressive coding levels that build on each other, similar to a real industry OA environment.


🧭 Structure

industry_coding_practice/
│
├── level1_basic.py
├── level2_processing.py
├── level3_refactor.py
├── level4_extend.py
│
├── test_level1.py
├── test_level2.py
├── test_level3.py
├── test_level4.py
│
└── README.md

Each level has:

  • A starter implementation file (levelX_*.py) with function headers, docstrings, and # TODO markers.
  • A corresponding test file (test_levelX.py) that you can run directly with Python.

⚙️ How to Run

  1. Implement the TODOs for the current level.

  2. Run tests for that level using:

    python test_level1.py
  3. Move to the next level and repeat the process.


🧩 Levels and Evaluation Criteria

Level 1 – Initial Design & Basic Functions

Focus: General programming skills, basic data structures, and error handling.

You must implement:

  • FILE_UPLOAD(file_name, size)
    Upload file to the server. Raise RuntimeError if file exists.
  • FILE_GET(file_name)
    Return size if exists, else None.
  • FILE_COPY(source, dest)
    Copy a file. Raise error if source missing. Overwrite destination if exists.

Skills Tested:

  • Control flow
  • Dictionaries/lists
  • Error handling

Level 2 – Data Structures & Data Processing

Focus: Data manipulation, searching, and sorting.

New method:

  • FILE_SEARCH(prefix)
    Return up to 10 files starting with prefix. Sort by:
    1. Size (descending)
    2. File name (ascending)

Skills Tested:

  • Sorting by multiple criteria
  • Filtering data
  • Building on existing methods

Level 3 – Refactoring & Encapsulation

Focus: Time-dependent data, encapsulation, and TTL handling.

New methods:

  • FILE_UPLOAD_AT(timestamp, file_name, file_size, ttl=None)
    Upload a file with an optional time-to-live (seconds). If a file is created with timestamp 10 and ttl 5, at timestamp 15 it is expired.
  • FILE_GET_AT(timestamp, file_name)
    Return file size only if file is still alive at timestamp.
  • FILE_COPY_AT(timestamp, source, dest)
    Copy a file only if it exists and is alive.
  • FILE_SEARCH_AT(timestamp, prefix)
    Search only for alive files.

Skills Tested:

  • Time-based logic
  • Conditional filtering
  • Code reuse and refactoring

Level 4 – Extending Design & Functionality

Focus: System rollback and code scalability.

New method:

  • ROLLBACK(timestamp)
    Restore the system to its state at the given timestamp.

Skills Tested:

  • State reconstruction
  • System design thinking
  • Maintaining backward compatibility

🧠 Tips for Practice

  • Work level by level — don’t skip ahead.
  • Aim for clean, reusable code at each step.
  • You can print your outputs while debugging; final tests should pass silently.

Good luck and have fun practicing!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages