Rust Day 14: Leetcode — Path Sum

Arjun Sunil Kumar
Go Rust
Published in
1 min readMay 3, 2022

Exams are nearing! Time is running out. Will take a pause on the blogging side of things. I ponder how society works. Many a time, we do “Work” which probably is not in our interest to feed ourselves. We have a side hustle going, but then, work is there filling a large part of your life. No wonder the 80/20 rule was discovered.

The 80/20 productivity rule is one of them. It clearly states that 80% of your results come from 20% of your efforts.

Anyways, let's dive into today's problem.

Problem:

Logic:

Use recursion to check: if you are null, if you are a leaf, or try exploring the children.

Code:

Syntax:

  1. if let Some(new_var_name) = root { This was a nice syntax instead of using the verbose match.
  2. curr_node.left.is_none() is another function that directly checks for null condition, rather than match.

Reference:

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