Intersection of two linked lists

Problem statement

We consider a linked list where each node has the following data structure:

	struct ListNode
		int val;
		ListNode *next;
		ListNode(int x) : val(x), next(NULL){}
We consider two linked lists L1 and L2. The goal is to determine if there is an intersection between L1 and L2. The following figure represents an example of intersection of two linked lists.

Indeed, both lists share the same nodes from c1 to c3.
Given the following prototype of the function:

	ListNode* getIntersectionNode(ListNode *headA, ListNode *headB);
the objective is to propose an algorithm with a time complexity of O(n) and a memory complexity of O(1).
If there is no intersection between both lists, the function must return NULL.
Finally we assume that there are no cycles in both lists.
Before delving into the reasonning, I invite you to try to solve this solution and to come back after a while ;)