Skip to content

Conversation

Peponks9
Copy link
Contributor

@Peponks9 Peponks9 commented Sep 6, 2025

Summary
This PR adds Rust implementations for Linked Lists coding interview patterns, translating the existing Python solutions to idiomatic Rust code.

Files Added

  • rust/Linked Lists/flatten_multi_level_list.rs
  • rust/Linked Lists/linked_list_intersection.rs
  • rust/Linked Lists/linked_list_reversal.rs
  • rust/Linked Lists/linked_list_reversal_recursive.rs

*Data Structures

  • Used Box<T> for owned nodes in simple cases
  • Used Rc<RefCell<T>> for shared mutable references (intersection detection)
  • Proper memory management with Rust's ownership system

Key Features

  • Maintained algorithmic complexity equivalent to python versions
  • Maintained comments as in python version

@Peponks9 Peponks9 changed the title Add Rust implementations for Linked Lists patterns (Part 1) Add Rust implementations for Linked Lists patterns Sep 6, 2025
Copy link
Collaborator

@Destiny-02 Destiny-02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Peponks9, looks good. Just 1 comment to address :)

@@ -0,0 +1,45 @@
#[derive(Debug)]
struct MultiLevelListNode {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave the MultiLevelListNode commented out and import it from module/folder called ds.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for other problems (if it's commented out in the python solution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants