Rust Day 12: Leetcode — Balanced Binary Tree

Arjun Sunil Kumar
Go Rust
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 &

https://users.rust-lang.org/t/ref-keyword-versus/18818/4
https://users.rust-lang.org/t/ref-keyword-versus/18818/12

_ in RUST

https://stackoverflow.com/a/37925519/1609570

Problem:

Logic:

Check the height of left and right node and get the diff at every node.

Code:

Syntax:

  1. One thing note, is that you should use a different variable name inside Some(b), different from the one in the match a{}.
  2. i32::abs() use to find the absolute value.

Found it Interesting?

Please show your support by 👏.

--

--

Arjun Sunil Kumar
Go Rust

Writes on Database Kernel, Distributed Systems, Cloud Technology, Data Engineering & SDE Paradigm. github.com/arjunsk