Giter VIP home page Giter VIP logo

99-rust-exercises's Introduction

WIP 99 Rust Exercises

https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems

Lists

  1. Find the last element of a list.
  2. Find the last but one element of a list.
  3. Find the K'th element of a list. The first element in the list is number 1.
  4. Find the number of elements of a list.
  5. Reverse a list.
  6. Find out whether a list is a palindrome. A palindrome can be read forward or backward; e.g. (x a m a x).
  7. Flatten a nested list structure.
  8. Eliminate consecutive duplicates of list elements.
  9. Pack consecutive duplicates of list elements into sublists. If a list contains repeated elements they should be placed in separate sublists.
  10. Run-length encoding of a list
  11. Run-length encoding of a list modified
  12. Decode a run-length encoded list.
  13. Run-length encoding of a list (direct solution).
  14. Duplicate the elements of a list.
  15. Replicate the elements of a list a given number of times.
  16. Drop every N'th element from a list.
  17. Split a list into two parts; the length of the first part is given.
  18. Extract a slice from a list.
  19. Rotate a list N places to the left.
  20. Remove the K'th element from a list.
  21. Insert an element at a given position into a list.
  22. Create a list containing all integers within a given range.
  23. Extract a given number of randomly selected elements from a list.
  24. Lotto: Draw N different random numbers from the set 1..M.
  25. Generate a random permutation of the elements of a list.
  26. Generate the combinations of K distinct objects chosen from the N elements of a list
  27. Group the elements of a set into disjoint subsets.
  28. Sorting a list of lists according to length of sublists

Arithmetic

  1. Determine whether a given integer number is prime.
  2. Determine the greatest common divisor of two positive integer numbers. Use Euclid's algorithm.
  3. Determine whether two positive integer numbers are coprime. Two numbers are coprime if their greatest common divisor equals 1.
  4. Calculate Euler's totient function phi(m).
  5. Determine the prime factors of a given positive integer. Construct a flat list containing the prime factors in ascending order.
  6. Determine the prime factors of a given positive integer. Construct a list containing the prime factors and their multiplicity.
  7. Calculate Euler's totient function phi(m) (improved)
  8. A list of prime numbers.
  9. Goldbach's conjecture.
  10. Given a range of integers by its lower and upper limit, print a list of all even numbers and their Goldbach composition.

Logic

  1. and 47 Define predicates and/2, or/2, nand/2, nor/2, xor/2, impl/2 and equ/2 (for logical equivalence) which succeed or fail according to the result of their respective operations; e.g. and(A,B) will succeed, if and only if both A and B succeed.
  2. Gray codes.
  3. Huffman codes.

99-rust-exercises's People

Contributors

sayden avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.