I try to write codes for a leetcode problem:

You are given two

non-emptylinked lists representing two non-negative

integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Add the two numbers and return it as a linked list.You may assume the two numbers do not contain any leading zero, except the number 0 itself.

Example:

Input:(2 -> 4 -> 3) + (5 -> 6 -> 4)Output:7 -> 0 -> 8Explanation:342 + 465 = 807.

The solution is easy, but I encounter such issue: how to create the return list?

```
pub struct ListNode {
pub val: i32,
pub next: Option<Box<ListNode>>,
}
impl ListNode {
#[inline]
fn new(val: i32) -> Self {
ListNode { next: None, val }
}
}
pub fn add_two_numbers(
l1: Option<Box<ListNode>>,
l2: Option<Box<ListNode>>,
) -> Option<Box<ListNode>> {
let mut l1_m = l1;
let mut l2_m = l2;
let mut num: i32 = 0;
loop {
let mut c = 0;
if let Some(node) = l1_m {
c += 1;
num += node.val;
l1_m = node.next;
};
if let Some(node) = l2_m {
c += 1;
num += node.val;
l2_m = node.next;
};
if c == 0 {
break;
}
}
loop {
let tmp: i32 = num / 10;
let a: i32 = num - tmp * 10;
println!("{}", a);
if tmp == 0 {
break;
}
num = tmp;
}
// how to create return list here???
}
fn main() {
let mut tmp1 = Box::new(ListNode::new(4));
let tmp2 = Box::new(ListNode::new(4));
tmp1.next = Some(tmp2);
let a: Option<Box<ListNode>> = Some(tmp1);
let b: Option<Box<ListNode>> = Some(Box::new(ListNode::new(9)));
add_two_numbers(a, b);
}
```

The ownership of rust seems to be difficult to create common structure in other languages,. Could anybody help? Thanks.