{"id":20086555,"url":"https://github.com/asarkar/99-scala","last_synced_at":"2025-08-03T03:08:30.335Z","repository":{"id":215430549,"uuid":"738920565","full_name":"asarkar/99-scala","owner":"asarkar","description":"S-99: Ninety-Nine Scala Problems","archived":false,"fork":false,"pushed_at":"2025-01-11T10:36:45.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-11T11:36:27.095Z","etag":null,"topics":["99-problems","99-scala-problems","99problems","functional-programming","ninety-nine-problems","ninety-nine-scala-problems","scala"],"latest_commit_sha":null,"homepage":"","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/asarkar.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":"2024-01-04T11:00:58.000Z","updated_at":"2025-01-11T10:36:49.000Z","dependencies_parsed_at":"2024-01-15T09:05:39.392Z","dependency_job_id":"1b04d10e-4e4c-48ac-b5aa-98a04928b753","html_url":"https://github.com/asarkar/99-scala","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"9092a6d86feeb447b749e40bef1f6868e2d9b786"},"previous_names":["asarkar/99-scala"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2F99-scala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2F99-scala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2F99-scala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asarkar%2F99-scala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asarkar","download_url":"https://codeload.github.com/asarkar/99-scala/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241518842,"owners_count":19975553,"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":["99-problems","99-scala-problems","99problems","functional-programming","ninety-nine-problems","ninety-nine-scala-problems","scala"],"created_at":"2024-11-13T16:01:34.949Z","updated_at":"2025-08-03T03:08:30.323Z","avatar_url":"https://github.com/asarkar.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[S-99: Ninety-Nine Scala Problems](https://aperiodic.net/phil/scala/s-99/)\n\n[![](https://github.com/asarkar/99-scala/workflows/CI/badge.svg)](https://github.com/asarkar/99-scala/actions)\n\n## Lists\n\n[P01](list/src/P01.scala) (*) Find the last element of a list.\n\n[P02](list/src/P02.scala) (*) Find the last but one element of a list.\n\n[P03](list/src/P03.scala) (*) Find the Kth element of a list.\n\n[P04](list/src/P04.scala) (*) Find the number of elements of a list.\n\n[P05](list/src/P05.scala) (*) Reverse a list.\n\n[P06](list/src/P06.scala) (*) Find out whether a list is a palindrome.\n\n[P07](list/src/P07.scala) (**) Flatten a nested list structure.\n\n[P08](list/src/P08.scala) (**) Eliminate consecutive duplicates of list elements.\n\n[P09](list/src/P09.scala) (**) Pack consecutive duplicates of list elements into sublists.\n\n[P10](list/src/P10.scala) (*) Run-length encoding of a list.\n\n[P11](list/src/P11.scala) (*) Modified run-length encoding.\n\n[P12](list/src/P12.scala) (**) Decode a run-length encoded list.\n\n[P13](list/src/P13.scala) (**) Run-length encoding of a list (direct solution).\n\n[P14](list/src/P14.scala) (*) Duplicate the elements of a list.\n\n[P15](list/src/P15.scala) (**) Duplicate the elements of a list a given number of times.\n\n[P16](list/src/P16.scala) (**) Drop every Nth element from a list.\n\n[P17](list/src/P17.scala) (*) Split a list into two parts.\n\n[P18](list/src/P18.scala) (**) Extract a slice from a list.\n\n[P19](list/src/P19.scala) (**) Rotate a list N places to the left.\n\n[P20](list/src/P20.scala) (*) Remove the Kth element from a list.\n\n[P21](list/src/P21.scala) (*) Insert an element at a given position into a list.\n\n[P22](list/src/P22.scala) (*) Create a list containing all integers within a given range.\n\n[P23](list/src/P23.scala) (**) Extract a given number of randomly selected elements from a list.\n\n[P24](list/src/P24.scala) (*) Lotto: Draw N different random numbers from the set 1..M.\n\n[P25](list/src/P25.scala) (*) Generate a random permutation of the elements of a list.\n\n[P26](list/src/P26.scala) (**) Generate the combinations of K distinct objects chosen from the N elements of a list.\n\n[P27](list/src/P27.scala) (**) Group the elements of a set into disjoint subsets.\n\n[P28](list/src/P28.scala) (**) Sorting a list of lists according to length of sublists.\n\n## Arithmetic\n\n[P31](arithmetic/src/P31.scala) (**) Determine whether a given integer number is prime.\n\n[P32](arithmetic/src/P32.scala) (**) Determine the greatest common divisor of two positive integer numbers.\n\n[P33](arithmetic/src/P33.scala) (*) Determine whether two positive integer numbers are coprime.\n\n[P34](arithmetic/src/P34.scala) (**) Calculate Euler’s totient function ϕ(m).\n\n[P35](arithmetic/src/P35.scala) (**) Determine the prime factors of a given positive integer.\n\n[P36](arithmetic/src/P36.scala) (**) Determine the prime factors of a given positive integer (2).\n\nP37 (**) Calculate Euler’s totient function ϕ(m) (improved).\n\nP38 (*) Compare the two methods of calculating Euler’s totient function.\n\n[P39](arithmetic/src/P39.scala) (*) A list of prime numbers.\n\n[P40](arithmetic/src/P40.scala) (**) Goldbach's conjecture.\n\n[P41](arithmetic/src/P41.scala) (**) A list of Goldbach compositions.\n\n## Logic and Codes\n\n[P46](logic/src/P46.scala) (**) Truth tables for logical expressions.\n\n[P47](logic/src/P47.scala) (*) Truth tables for logical expressions (2).\n\nP48 (**) Truth tables for logical expressions (3).\n\n[P49](logic/src/P49.scala) (**) Gray code.\n\n[P50](logic/src/P50.scala) (***) Huffman code.\n\n## Binary Trees\n\nP54 Omitted; our tree representation will only allow well-formed trees.\n\n[P55](bintree/src/P55.scala) (**) Construct completely balanced binary trees.\n\n[P56](bintree/src/P56.scala) (**) Symmetric binary trees.\n\n[P57](bintree/src/P57.scala) (**) Binary search trees (dictionaries).\n\n[P58](bintree/src/P58.scala) (**) Generate-and-test paradigm.\n\n[P59](bintree/src/P59.scala) (**) Construct height-balanced binary trees.\n\n[P60](bintree/src/P60.scala) (**) Construct height-balanced binary trees with a given number of nodes.\n\n[P61](bintree/src/P61.scala) (*) Count the leaves of a binary tree.\n\n[P61A](bintree/src/P61A.scala) (*) Collect the leaves of a binary tree in a list.\n\n[P62](bintree/src/P62.scala) (*) Collect the internal nodes of a binary tree in a list.\n\n[P62B](bintree/src/P62B.scala) (*) Collect the nodes at a given level in a list.\n\n[P63](bintree/src/P63.scala) (**) Construct a complete binary tree.\n\n[P64](bintree/src/P64.scala) (**) Layout a binary tree (1).\n\n[P65](bintree/src/P65.scala) (**) Layout a binary tree (2).\n\nP66 (***) Layout a binary tree (3).\n\n[P67](bintree/src/P67.scala) (**) A string representation of binary trees.\n\n[P68](bintree/src/P68.scala) (**) Preorder and inorder sequences of binary trees.\n\n[P69](bintree/src/P69.scala) (**) Dotstring representation of binary trees.\n\n## Multiway Trees\n\nP70B Omitted; we can only create well-formed trees.\n\n[P70C](mtree/src/P70C.scala) (*) Count the nodes of a multiway tree.\n\n[P70](mtree/src/P70.scala) (**) Tree construction from a node string.\n\n[P71](mtree/src/P71.scala) (*) Determine the internal path length of a tree.\n\n[P72](mtree/src/P72.scala) (*) Construct the postorder sequence of the tree nodes.\n\n[P73](mtree/src/P73.scala) (**) Lisp-like tree representation.\n\n## Graphs\n\nP80 (***) Conversions.\n\n[P81](graph/src/P81.scala) (**) Path from one node to another one.\n\n[P82](graph/src/P82.scala) (*) Cycle from a given node.\n\n[P83](graph/src/P83.scala) (**) Construct all spanning trees.\n\n[P84](graph/src/P84.scala) (**) Construct the minimal spanning tree.\n\n[P85](graph/src/P85.scala) (**) Graph isomorphism.\n\n[P86](graph/src/P86.scala) (**) Node degree and graph coloration.\n\n[P87](graph/src/P87.scala) (**) Depth-first order graph traversal.\n\n[P88](graph/src/P88.scala) (**) Connected components.\n\n[P89](graph/src/P89.scala) (**) Bipartite graphs.\n\n## Miscellaneous Problems\n\nP90 (**) Eight queens problem\n\n[P91](misc/src/P91.scala) (**) Knight’s tour.\n\n[P92](misc/src/P92.scala) (***) Von Koch’s conjecture.\n\nP93 (***) An arithmetic puzzle.\n\nP94 (***) Generate K-regular simple graphs with N nodes.\n\n[P95](misc/src/P95.scala) (**) English number words.\n\nP96 (**) Syntax checker.\n\nP97 (**) Sudoku.\n\nP98 (***) Nonograms.\n\nP99 (***) Crossword puzzle.\n\n## Running tests\n\n```\n./.github/run.sh\n```\n\nTo run all tests from a package:\n```\n./.github/run.sh \u003cpackage prefix\u003e\n```\n\n## License\n\nReleased under [Apache License v2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasarkar%2F99-scala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasarkar%2F99-scala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasarkar%2F99-scala/lists"}