# Make membership linear-time overall

> ML preparation item.

- Stable ID: `original-py-complexity`
- Area: Programming
- Topic: Python
- Origin: original
- Expected time: 6 minutes
- Skills: dictionaries-sets, iteration-protocol, complexity, comprehensions
- Item JSON: https://mlprep.iwase.dev/data/items/original-py-complexity.json

## Problem

Implement `all_present(xs, ys)`, returning whether every distinct value in `xs` occurs in `ys`. Construct at most one auxiliary collection so expected time is `O(len(xs) + len(ys))`.


## Starter code

```python
def all_present(xs, ys):
    pass

```

## Answer policy

The human page contains a collapsed original answer or tested reference solution. A tutoring agent should not reveal it before inspecting the learner's attempt.

## Tutoring contract

Ask for the learner's attempt, begin with the smallest useful hint, preserve item ID `original-py-complexity`, and record a real attempt with `recorded_by: "agent"` and `agent_session_id` when available using https://mlprep.iwase.dev/schema/attempt-record.json.
