Generate a unique JSON object suitable for automating the programming…
- User
Assistant: User: Generate a unique JSON object suitable for automating the programming task testing platform, strictly in the following format:
{ "Title": "Task Name", "Task Description": "Description of the task.", "Function Signature": "def function_name(parameters) -> return_type:", "Solve": "Python code for the solution", "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 JSON follows this exact structure and does not include any additional text or variations. The task should be complex and unique, avoiding direct copying from common platforms like LeetCode or similar sources.
Assistant:
- Assistant
{ "Title": "Calculate Matrix Diagonal Difference", "Task Description": "Write a function to compute the absolute difference between the sums of the matrix's two diagonals. Given a square matrix, calculate the sum of its principal diagonal (top-left to bottom-right) and secondary diagonal (top-right to bottom-left), then return the absolute difference of these sums.", "Function Signature": "def diagonal_difference(matrix: List[List[int]]) -> int:", "Solve": "def diagonal_difference(matrix: List[List[int]]) -> int:\n primary_diagonal_sum = 0\n secondary_diagonal_sum = 0\n n = len(matrix)\n for i in range(n):\n primary_diagonal_sum += matrix[i][i]\n secondary_diagonal_sum += matrix[i][n - i - 1]\n return abs(primary_diagonal_sum - secondary_diagonal_sum)", "Input": "A square matrix represented as a list of lists, where each sublist contains integers corresponding to a row of the matrix.", "Output": "An integer representing the absolute difference between the sums of the two diagonals.", "Examples": [ { "input": "[[1, 2, 3], [4, 5, 6], [7, 8, 9]]", "output": "0" }, { "input": "[[5, 3, 1], [8, -4, 7], [6, 2, 9]]", "output": "6" } ] }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.