DSA Tracker

DSA Tracker

Rust compiler

rustc 1.75+, runs on our server

main.rs
Press Run and what your code prints shows up here.

Rust online compiler and code runner

Compile and run Rust code online with standard library and full compiler error diagnostics.

Does this online Rust compiler show borrow checker diagnostics?

Yes. Programs are compiled with a modern stable rustc compiler that provides detailed borrow checker diagnostics.

Ready to practise real interview problems in Rust?

Solve 370 curated problems merged from Striver A2Z, Love Babbar 450 and Apna College, with no duplicate questions.

Questions people ask

Is Rust compilation fast?

Yes, compiled on dedicated keyless runners with smart result caching.

Can I run Rust online without installing Cargo or rustc?

Yes. You can write, compile, and run Rust code directly in your browser without setting up rustup, Cargo, or a local toolchain. The compiler is free and compiles your code on demand.

How do I read standard input in a Rust program?

Switch to the Input tab in the console panel to enter your input text before running. Inside your code, read from standard input using `std::io::stdin().read_line(&mut buffer)` or `std::io::read_to_string`. The runner routes this input directly into your program.

What are the execution limits for Rust code?

Programs run with a CPU time limit of 5 seconds and a wall-clock limit of 10 seconds. Sandboxed runners do not allow network calls or persistent disk modifications. Source code length must remain under 20,000 characters and input under 4,000 characters.

Can I use external crates and what Rust edition is used?

Code is compiled with modern stable rustc using the 2021 edition and full borrow checker diagnostics. Only the Rust standard library is available, meaning third-party crates from crates.io are not supported. Common standard types such as `Vec`, `HashMap`, and `String` work out of the box.

Can I practice coding interview problems in Rust here?

You can run Rust programs in the editor, but DSA Tracker problem grading does not support Rust. Graded submissions against hidden test cases are supported for 356 curated problems in C++, Java, Python, and JavaScript only.

Do I need an account to compile Rust code?

No account or login is required to compile and run Rust code. An account is only needed if you want to track your problem progress or use AI coach credits.

Writing DSA solutions in Rust: what trips people up

Small facts about Rust that decide whether an interview solution passes or times out.

  • Read all input at once

    Read stdin into one String and walk it with split_whitespace; locking and reading line by line is slower and longer to write.

  • Overflow behaves differently by build

    Debug builds panic on integer overflow and release builds wrap around. Use i64 and checked_ or wrapping_ methods to make the intent clear.

  • BinaryHeap is a max-heap

    Wrap values in std::cmp::Reverse for a min-heap, as shortest-path problems need.

  • Index into vectors for graphs

    Store a graph as Vec<Vec<usize>> of indices instead of references; it keeps the borrow checker happy and stays fast.

  • Pick the right map

    HashMap is unordered and fast; BTreeMap keeps keys sorted when you need range queries or ordered output.