YASH Technologies workflow components may need to insert an item at an exact position in an ordered singly linked list. Given the head of a singly linked list, a value, and a zero-based position, insert a new node at that position and return the updated head.
The position may be 0, which inserts the node before the current head, or equal to the current list length, which appends the node. The position is guaranteed to be valid.
head, a ListNode or None; value, an integer; and position, a zero-based integer.ListNode of the list after insertion.ListNode has integer field val and pointer field next.def insert_at_position(head, value, position):