Algorithm · Meta · Medium
Problem You are given the heads of two singly linked lists, head1 and head2. Every node stores a string in node.val (the string may be empty). Walk each list from head to tail, concatenating the node values in order, to form two strings S1 and S2. Return true if S1 and S2 are identical, otherwise false. Requirements You must not materialize the full concatenated strings before comparing them. The comparison must be performed incrementally, as you traverse the lists. Target…
Checking your access…