_99-problems-clojure-lists

Table of Contents

Problems Clojure Lists

List Problems

1. Write a function last : 'a list -> 'a option that returns the last element of a list.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/list_last.clj }}

2. Find the last but one (last and penultimate) elements of a list.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/last_two.clj }}

3. Find the kth element of a list.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/kth.clj }}

4. Find the number of elements of a list.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/list_length.clj }}

5. Reverse a list.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/list_reverse.clj }}

6. Find out whether a list is a palindrome.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/list_palindrome.clj }}

7. Flatten a nested list structure.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/list_flatten.clj }}

8. Eliminate consecutive duplicates of list elements.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/remove_consecutive_duplicates.clj }}

9. Pack consecutive duplicates of list elements into sublists.

{{# include _include/code/algorithms/99-problems/clj/src/clj/lists/pack_consecutive_duplicates.clj }}