HF RL Explorer

Task: Implement a Custom Heap with Compare Predicate in Python

Task: Implement a Custom Heap with Compare Predicate in Python: a task in Terminal-Lego-15k (Harbor dataset). Python's built-in heapq module provides heap queue operations but does not natively support a custom comparison predicate or key function like sorted() does. Your task is to implement a…

The task

Python's built-in `heapq` module provides heap queue operations but does not natively support a custom comparison predicate or key function like `sorted()` does. Your task is to implement a wrapper class called `KeyHeap` that allows using `heapq` with a custom key function for comparison.

Part of PrimeIntellect/Terminal-Lego-15k.