Please generate a unique JSON object suitable for automating the…
- User
Assistant: User: Please 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 must have function signature from 'Function Signature'.", "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: 1.The task includes nested structures. 2.The JSON follows this exact structure and does not include any additional text or variations. 3.The task should be complex and unique, avoiding direct copying from common platforms like LeetCode or similar sources. 4.The solution must not use any imports in the code (i.e., no import statements). 5.The solution must contain only one function. 6.Ensure that the outputs are different each time, so no two consecutive outputs are the same. Assistant:
- Assistant
{ "Title": "Flatten Nested List", "Task Description": "Write a function that takes a nested list of integers and returns a flattened version of it. The list can have multiple nesting levels, and the order should be preserved.", "Function Signature": "def flatten_nested_list(nested_list: list) -> list:", "Solve": "def flatten_nested_list(nested_list: list) -> list:\n def flatten(lst, res):\n for item in lst:\n if isinstance(item, list):\n flatten(item, res)\n else:\n res.append(item)\n result = []\n flatten(nested_list, result)\n return result", "Input": "A list of integers and lists, where lists can contain further nested lists.", "Output": "A single list containing all integers from the nested structure in the order they appear.", "Examples": [ { "input": "[1, [2, [3, 4], 5], 6]", "output": "[1, 2, 3, 4, 5, 6]" }, { "input": "[[1, 2, [3, 4]], [5, [6, 7], 8], 9]", "output": "[1, 2, 3, 4, 5, 6, 7, 8, 9]" } ] }