gpt-4o-2024-08-06· OpenAI
WildChat-4.8M (AI2)
Please generate a unique programming task in JSON format with the following structure: {…
- User
Please generate a unique programming task in JSON format with the following structure: { "Title": "Task Name", "Task Description": "Description of the task.", "Function Signature": "def function_name(parameters) -> return_type:", "Solve": "", "Input": "Description of the input parameters.", "Output": "Description of the expected output.", "Examples": [ { "input": "Example input here", "output": "Expected output here" }, { "input": "Another example input here", "output": "Another expected output here" } ] } Ensure that:
- The task includes dynamic programming with constraints.
- The task must avoid the following titles: .
- The task should be unique and complex.
- The "Solve" section should remain empty.
- Assistant
{ "Title": "Optimal Path in Grid with Obstacles", "Task Description": "You are given a 2D grid where each cell has a cost associated with stepping into it. Some cells are marked as obstacles, and you cannot step into them. Your task is to find the path from the top-left corner to the bottom-right corner that minimizes the total stepping cost, using dynamic programming. You can only move right or down.", "Function Signature": "def min_path_cost(grid: List[List[int]]) -> int:", "Solve": "", "Input": "A 2D list 'grid' where each element is either a positive integer representing the stepping cost or -1 representing an obstacle. The grid has at least one row and one column.", "Output": "An integer representing the minimum cost to reach the bottom-right corner from the top-left corner. If it's not possible to reach the destination, return -1.", "Examples": [ { "input": "grid = [[1, 3, 1], [1, -1, 1], [4, 2, 1]]", "output": "7" }, { "input": "grid = [[1, 2, -1], [2, 3, -1], [4, 2, 1]]", "output": "-1" } ] }