Call a mock API, parse the returned JSON array and build a linked list from it.
Asked in the technical screen stage. The grader provides the mock API response as a JSON string.
Implement build_linked_list(api_response). Parse the JSON array and return the head of a singly linked list containing the values in the same order. Use the provided ListNode structure with val and next fields. Return None for an empty array.
def build_linked_list(api_response):