benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 77498028-a8e1-57ed-a329-008e7d4daa9b

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import heapq
import collections

def task_func(x, n):
    """
    Find the n most common letters in a dictionary, x, where the key letters and the values are their frequencies.

    Parameters:
    - x (dict): The dictionary of letter frequencies.
    - n (int): The number of most frequent letters to return.

    Returns:
    - list: The n most frequent letters.

    Requirements:
    - heapq
    - collections

    Example:
    >>> task_func({'a': 1, 'b': 2, 'c': 3}, 2)
    ['c', 'b']
    """

instruct prompt

Find the n most common letters in a dictionary, x, where the key letters and the values are their frequencies.
The function should output with:
    list: The n most frequent letters.
You should write self-contained code starting with:

Code

import heapq
import collections
def task_func(x, n):

code prompt

Code

import heapq
import collections
def task_func(x, n):

entry point

task_func

libs

  • collections
  • heapq

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import