Back to problems

Subtract Two Numbers Represented by Forward-Order Linked Lists

Algorithm · Microsoft · Hard

Subtract Linked List Numbers Medium · Topics · Company Tags · Hints You are given the heads of two non‑empty singly linked lists, l1 and l2. Each list represents a non‑negative integer whose digits are stored in forward order (most significant digit at the head). Your task is to compute the difference l1 - l2 and return the head of a new linked list that holds the result in the same most‑significant‑digit‑first format. For automated judging, the inputs will be supplied as…

Checking your access…