An open API service indexing awesome lists of open source software.

https://github.com/hellojukay/ocaml-99problems

The answer of https://ocaml.org/learn/tutorials/99problems.html
https://github.com/hellojukay/ocaml-99problems

Last synced: about 1 year ago
JSON representation

The answer of https://ocaml.org/learn/tutorials/99problems.html

Awesome Lists containing this project

README

          

# ocaml-99problems
The answer of https://ocaml.org/learn/tutorials/99problems.html


- [x] 1. Write a function last : 'a list -> 'a option that returns the last element of a list. (easy) [[finished]](main.ml#L1)
- [x] 2. Find the last but one (last and penultimate) elements of a list. (easy) [[finished]](main.ml#L5)
- [x] 3. Find the K'th element of a list. (easy) [[finished]](main.ml#L13)
- [x] 4. Find the number of elements of a list. (easy) [[finished]](main.ml#L25)
- [x] 5. Reverse a list. (easy) [[finished]](main.ml#L28)
- [x] 6. Find out whether a list is a palindrome. (easy) [[finished]](main.ml#L32)
- [x] 7. Flatten a nested list structure. (medium) [[finished]](main.ml#L48)
- [x] 8. Eliminate consecutive duplicates of list elements. (medium) [[finished]](main.ml#L65)
- [x] 9. Pack consecutive duplicates of list elements into sublists. (medium) [[finished]](main.ml#L80)
- [x] 10. Run-length encoding of a list. (easy) [[finished]](main.ml#L100)
- [x] 11. Modified run-length encoding. (easy) [[finished]](main.ml#L119)
- [x] 12. Decode a run-length encoded list. (medium) [[finished]](main.ml#L140)
- [x] 13. Run-length encoding of a list (direct solution). (medium) [[finished]](main.ml#L156)
- [x] 14. Duplicate the elements of a list. (easy) [[finished]](main.ml#L168)
- [x] 15. Replicate the elements of a list a given number of times. (medium) [[finished]](main.ml#L172)
- [x] 16. Drop every N'th element from a list. (medium) [[finished]](main.ml#L184)
- [x] 17. Split a list into two parts; the length of the first part is given. (easy) [[finished]](main.ml#L197)
- [x] 18. Extract a slice from a list. (medium) [[finished]](main.ml#L208)
- [x] 19. Rotate a list N places to the left. (medium) [[finished]](main.ml#L216)
- [x] 20. Remove the K'th element from a list. (easy) [[finished]](main.ml#L229)
- [x] 21. Insert an element at a given position into a list. (easy) [[finished]](main.ml#L235)
- [x] 22. Create a list containing all integers within a given range. (easy) [[finished]](main.ml#L243)
- [ ] 23. Extract a given number of randomly selected elements from a list. (medium)
- [ ] 24. Lotto: Draw N different random numbers from the set 1..M. (easy)
- [x] 25. Generate a random permutation of the elements of a list. (easy) [[finished]](main.ml#L251)
- [ ] 26. Generate the combinations of K distinct objects chosen from the N elements of a list. (medium)
- [ ] 27. Group the elements of a set into disjoint subsets. (medium)
- [ ] 28. Sorting a list of lists according to length of sublists. (medium)
- [ ] 31. Determine whether a given integer number is prime. (medium)
- [ ] 32. Determine the greatest common divisor of two positive integer numbers. (medium)
- [ ] 33. Determine whether two positive integer numbers are coprime. (easy)
- [ ] 34. Calculate Euler's totient function φ(m). (medium)
- [ ] 35. Determine the prime factors of a given positive integer. (medium)
- [ ] 36. Determine the prime factors of a given positive integer (2). (medium)
- [ ] 37. Calculate Euler's totient function φ(m) (improved). (medium)
- [ ] 38. Compare the two methods of calculating Euler's totient function. (easy)
- [x] 39. A list of prime numbers. (easy) [[finished]](main.ml#L277)
- [ ] 40. Goldbach's conjecture. (medium)
- [ ] 41. A list of Goldbach compositions. (medium)
- [ ] 46 & 47. Truth tables for logical expressions (2 variables). (medium)
- [ ] 48. Truth tables for logical expressions. (medium)
- [ ] 49. Gray code. (medium)
- [ ] 50. Huffman code (hard)
- [ ] 55. Construct completely balanced binary trees. (medium)
- [ ] 56. Symmetric binary trees. (medium)
- [ ] 57. Binary search trees (dictionaries). (medium)
- [ ] 58. Generate-and-test paradigm. (medium)
- [ ] 59. Construct height-balanced binary trees. (medium)
- [ ] 60. Construct height-balanced binary trees with a given number of nodes. (medium)
- [ ] 61. Count the leaves of a binary tree. (easy)
- [ ] 61A. Collect the leaves of a binary tree in a list. (easy)
- [ ] 62. Collect the internal nodes of a binary tree in a list. (easy)
- [ ] 62B. Collect the nodes at a given level in a list. (easy)
- [ ] 63. Construct a complete binary tree. (medium)
- [ ] 64. Layout a binary tree (1). (medium)
- [ ] 65. Layout a binary tree (2). (medium)
- [ ] 66. Layout a binary tree (3). (hard)
- [ ] 67. A string representation of binary trees. (medium)
- [ ] 68. Preorder and inorder sequences of binary trees. (medium)
- [ ] 69. Dotstring representation of binary trees. (medium)
- [ ] 70C. Count the nodes of a multiway tree. (easy)
- [ ] 70. Tree construction from a node string. (medium)
- [ ] 71. Determine the internal path length of a tree. (easy)
- [ ] 72. Construct the bottom-up order sequence of the tree nodes. (easy)
- [ ] 73. Lisp-like tree representation. (medium)
- [ ] 80. Conversions. (easy)
- [ ] 81. Path from one node to another one. (medium)
- [ ] 82. Cycle from a given node. (easy)
- [ ] 83. Construct all spanning trees. (medium)
- [ ] 84. Construct the minimal spanning tree. (medium)
- [ ] 85. Graph isomorphism. (medium)
- [ ] 86. Node degree and graph coloration. (medium)
- [ ] 87. Depth-first order graph traversal. (medium)
- [ ] 88. Connected components. (medium)
- [ ] 89. Bipartite graphs. (medium)
- [ ] 90. Generate K-regular simple graphs with N nodes. (hard)
- [ ] 91. Eight queens problem. (medium)
- [ ] 92. Knight's tour. (medium)
- [ ] 93. Von Koch's conjecture. (hard)
- [ ] 94. An arithmetic puzzle. (hard)
- [ ] 95. English number words. (medium)
- [ ] 96. Syntax checker. (medium)
- [ ] 97. Sudoku. (medium)
- [ ] 98. Nonograms. (hard)
- [ ] 99. Crossword puzzle. (hard)