Rust Day 12: Leetcode — Balanced Binary Tree
Published in
2 min readMay 1, 2022
Starting this early today, so that I can manage my time well. Time is one thing, If we have in surplus, we don’t really manage well — You might even end up polluting your mind with some useless thoughts. If we don’t have enough, we start complaining!
Before we start, I just read about theRef
keyword. Let me just understand how it is different from &
.
Ref vs &
_ in RUST
Problem:
Logic:
Check the height of left
and right
node and get the diff at every node.
Code:
Syntax:
- One thing note, is that you should use a different variable name inside
Some(b)
, different from the one in thematch a{}
. i32::abs()
use to find the absolute value.
Found it Interesting?
Please show your support by 👏.