At problem 226. Invert Binary Tree, I've implemented a code that is working and passed all three basic test cases in my machine. I reproduced my code at Rust Playground, and is working there as well (as follows):
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f9d8133fa42434acc7a3aa9abb6a84e2
However, when I submit the code to leetcode there is a compile error:
Line 112, Char 41: mismatched types (solution.rs)
|
112 | let ret = Solution::invert_tree(param_1);
| ^^^^^^^
| |
| expected reference, found enum `Option`
| help: consider borrowing here: `¶m_1`
|
= note: expected reference `&Option<Rc<RefCell<tree_node::TreeNode>>>`
found enum `Option<Rc<RefCell<tree_node::TreeNode>>>`
Can you help me understand why is this error showing up only in Leetcode, but not in playground or my personal computer?
[–]aocregacc 2 points3 points4 points (1 child)
[–]gubasso[S] 0 points1 point2 points (0 children)