Skip to content

sir-gon/algorithm-exercises-rust

Repository files navigation

Algorithm Exercises (Rust 🦀)

Rust on Linux CI Test Markdown Lint YAML lint

GitHub GitHub language count GitHub top language codecov

Quality Gate Status Coverage Bugs Code Smells Duplicated Lines (%)

TL;DR

Algorithms Exercises solved in Rust Developed with TDD.

Rust Docker

Go to Install and run

What is this?

This repository is part of a series that share and solve the same objectives, with the difference that each one is based on a different software ecosystem, depending on the chosen programming language:

Objetives

Functional

  • For academic purposes, it is an backup of some algorithm exercises (with their solutions), proposed by various sources: leetcode, hackerrank, projecteuler, ...

  • The solutions must be written on "vanilla code", that is, avoiding as much as possible the use of external libraries (in runtime).

  • Adoption of methodology and good practices. Each exercise is implemented as a unit test set, using TDD (Test-driven Development) and Clean Code ideas.

Technical

Foundation of a project that supports:

  • Explicit typing when the language supports it, even when it is not mandatory.
  • Static Code Analysis (Lint) of code, scripts and documentation.
  • Uniform Code Styling.
  • Unit Test framework.
  • Coverge collection. High coverage percentage. Equal or close to 100%.
  • Pipeline (Github Actions). Each command must take care of its return status code.
  • Docker-based workflow to replicate behavior in any environment.
  • Other tools to support the reinforcement of software development good practices.

Install and Run

Install and run directly with make

It is assumed that the following tools have already been installed:

Using Rust tools in your SO. You must install dependencies:

make dependencies
make lint # optional
make build
make test

About development

rustc --version
rustc 1.89.0 (29483883e 2025-08-04)

cargo --version
cargo 1.89.0 (c24e10642 2025-06-23)

rustup --version
rustup 1.28.2 (e4f3ad6f8 2025-04-28)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.89.0 (29483883e 2025-08-04)`

Algorithm excersices sources

  • Leetcode online platform for coding interview preparation.
  • HackerRank competitive programming challenges for both consumers and businesses.
  • Project Euler a series of computational problems intended to be solved with computer programs.

Use these answers to learn some tip and tricks for algorithms tests.

Disclaimer. Why I publish solutions?

As Project Euler says:

https://projecteuler.net/about#publish

I learned so much solving problem XXX, so is it okay to publish my solution elsewhere?
It appears that you have answered your own question. There is  thing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, that will rarely be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.

However, the rule about sharing solutions outside of Project Euler does not apply to the first one-hundred problems, as long as any discussion clearly aims to instruct methods, not just provide answers, and does not directly threaten to undermine the enjoyment of solving later problems. Problems 1 to 100 provide a wealth of helpful introductory teaching material and if you are able to respect our requirements, then we give permission for those problems and their solutions to be discussed elsewhere.

If you have better answers or optimal solutions, fork and PR-me

Enjoy 😁 !

Status

License

LICENSE.md

Coverage

Coverage

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published