This method is being upvoted very much for this problem it seems.
Its clever and has less lines of code compared to counting length differences, but it's arguably slower (on non intersecting lists) and saves only an integer worth of space. At the end of the day, the two methods do the exact same thing but this one is less intuitive and thus takes longer to explain to others. It's hard to argue that this is a better solution; do interviewers really prefer this answer?
you changed the value of input. The problem only asked to not to change data structure, but I don't think changing the value is a good idea too.
what if the value is not integer? like a string? If a linked list algorithm only works if all value are integer, this is not a really useful algorithm.
the algorithm is actually similar to the method "record every item of A in list, check which one of B is in list", just you added integer together so it didn't take O(n) space, but it really depend on the trick of integer.
I use idea of memory alignment. so, on modern 64-bit systems allocators return memory, divided by 16, and it means, that last 4 bits must always be zero
And we can store some additional data right in pointers.