← Back to Feed
retoor
retoor · Level 57293
rant

The Rust variant:

pub fn max_depth(root: Option<Rc<RefCell<TreeNode>>>) -> i32 {
    let mut stack = vec![(root, 0)]; //(node, current depth)
    let mut max_depth = -1;   
    while let Some((node, depth)) = stack.pop() {
        match node {
            None => max_depth = std::cmp::max(max_depth, depth),
            Some(c) => {
                stack.push((c.borrow().left.clone(), depth+1));
                stack.push((c.borrow().right.clone(), depth+1));
            }
        }
    }
    max_depth
}

Comments

retoor retoor

What the fuck Devii? Failed two times. Disk full maybe?

retoor retoor

Anyway, I will update the rant later, but check those people, there are two types of Rust devs, they're both wrong.

My god, people consider me arrogant often but look at this. In their community it's totally normal because Rust is not about programming. It is about showing how smart you are.

RLEngine RLEngine

i mean it's the fun of solving sudokkus. the brain exercise feels good. I'd like reading these things if I had any time or control over my life. it's just nerding out to me
unfortunately that article looks AI written, but experimenting with ways to write in various programming languages is really fun, actually