title: How do I form a linked list while iterating over the digits of a number?
body: <p>I want to form a linked list which is reversed in order of the digits of the number. For eg, if the number is 523, the linked list would be 3->2->5.</p>
  
  <p>I tried iterating over the number and forming a list but I am unable to deduce how do I form a linked list in O(n)?!
  My current codebase is stuck here:</p>
  
  <pre><code>def form_linked_list(self, number):
      final_list = ListNode(number%10)
      number = int(number/10)
      while(number):
          final_list.next = ListNode(number%10)
          number = int(number/10)
      return final_list
  </code></pre>
  
  <p>I expect to form a linked list from the given number in reverse order. I am unable to deduce the logic to do so.</p>