{"id":26511411,"url":"https://github.com/jlprat/99-scala-problems","last_synced_at":"2025-07-11T13:07:34.484Z","repository":{"id":81055393,"uuid":"52728309","full_name":"jlprat/99-scala-problems","owner":"jlprat","description":"This is another take on 99 Scala Problems. However, the purpose of this is not to show how good I am solving them, but offering a way to beginners to practice and write their own solutions. This project will contain tests and the public interfaces of each problem, so anybody is free to implement solutions in their own way!","archived":false,"fork":false,"pushed_at":"2016-05-14T13:36:45.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T02:35:12.403Z","etag":null,"topics":["beginner-friendly","learning","problems","scala"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jlprat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-28T15:35:23.000Z","updated_at":"2021-08-29T10:28:46.000Z","dependencies_parsed_at":"2023-04-14T23:02:02.974Z","dependency_job_id":null,"html_url":"https://github.com/jlprat/99-scala-problems","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jlprat/99-scala-problems","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlprat%2F99-scala-problems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlprat%2F99-scala-problems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlprat%2F99-scala-problems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlprat%2F99-scala-problems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlprat","download_url":"https://codeload.github.com/jlprat/99-scala-problems/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlprat%2F99-scala-problems/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264816085,"owners_count":23668116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginner-friendly","learning","problems","scala"],"created_at":"2025-03-21T02:33:51.332Z","updated_at":"2025-07-11T13:07:34.477Z","avatar_url":"https://github.com/jlprat.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 99-scala-problems\n## Intro\nThis is another take on 99 Scala Problems. However, the purpose of this is not to show how good I am solving them, but offering a way to beginners to practice and write their own solutions. This project will contain tests and the public interfaces of each problem, so anybody is free to implement solutions in their own way!\n\nThis 99 Scala problems are an adaptation of http://aperiodic.net/phil/scala/s-99/ which at it's turn are an adaptation of https://sites.google.com/site/prologsite/prolog-problems. I a couple of exercices to make them more testable.\n\n## Purpose\nThe purpose of this exercercises is to practice and learn Scala, and using already built-in functions is discouraged.\n\nI decided to start with this project because, long time ago, when I discovered the 99 Scala Problems, I had a lot of fun and I learned a lot about Scala. Recently, I stumbled upon them again, and I realized that there are no github projects (or at least, I couldn't find any) that could be used as a sandbox, where people can code their own solutions and run them against a battery of tests.\n\nAs in the original version, problems are in groupped in 7 different types: Lists, Arithmetic, Logic and Codes, Binary Trees, Multiway Trees, Graphs and Miscellaneous. Also the problems have different levels of difficulty marked by stars (*), being 1 star the easiest and 3 stars the most difficult ones.\n\n## How to work with this project\nIt's easy, just pick a problem, read the tests, and implement the methods in the class. Some problems offer different alternatives to implement or interesting things to do, like adding your custom methods to Lists for example.\n\nEach problem is located in the `src` folder under the corresponding package, so P01 is under `com.github.jlprat.ninetynine.P01`. Tests follow the same structure and are located under the `test` folder.\n\n## How to run the tests\nOnce you are ready with your implementation open a terminal, go to the project folder and just run:\n\u003e sbt test\n\nOr if you want to run a specific test, for example P01 you can run:\n\n\u003e sbt testOnly com.github.jlprat.ninetynine.p01.P01Spec\n\n##Problem list\n### Working with Lists\nP01\\*: Find the last element of a list  \nP02\\*: Find the penultimate element of a list (last but one)  \nP03\\*: Find the *k*\u003csup\u003eth\u003c/sup\u003e element of a list  \nP04\\*: Find the number of elements of a list  \nP05\\*: Reverse a list  \nP06\\*: Find out if a list is a palindrome  \nP07\\*\\*: Flatten a nested list structure  \nP08\\*\\*: Eliminate consecutive duplicates of list elements  \nP09\\*\\*: Pack consecutive duplicates of list elements into sublists  \nP10\\*: Run-length encoding of a list (Consecutive duplicates of elements are encoded as tuples (N, E) where N is the number of duplicates of the element E)  \nP11\\*: Modified run-length encoding. Only elements with duplicates are transferred as (N, E) terms\nP12\\*\\*: Decode a run-length encoded list \nP13\\*\\*: Run-length encoding of a list (direct solution)  \nP14\\*: Duplicate the elements of a list  \nP15\\*\\*: Duplicate the elements of a list a given number of times  \nP16\\*\\*: Drop every Nth element from a list  \nP17\\*: Split a list into two parts  \nP18\\*\\*: Extract a slice from a list  \nP19\\*\\*: Rotate a list N places to the left  \nP20\\*: Remove the Kth element from a list  \nP21\\*: Insert an element at a given position into a list  \nP22\\*: Create a list containing all integers within a given range  \nP23\\*\\*: Extract a given number of randomly selected elements from a list  \nP24\\*: Lotto: Draw N different random numbers from the set 1..M  \nP25\\*: Generate a random permutation of the elements of a list  \nP26\\*\\*: Generate the combinations of K distinct objects chosen from the N elements of a list  \nP27\\*\\*: Group the elements of a set into disjoint subsets  \nP28\\*\\*: Sorting a list of lists according to length of sublists  \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlprat%2F99-scala-problems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlprat%2F99-scala-problems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlprat%2F99-scala-problems/lists"}