+ >>> least_common([1, 1, 1, 2, 2, 3, 3, 3, 4], count=2)
+ [4, 2]
+
+ """
+ p = population_counts(lst)
+ mc = p.most_common()[-count:]
+ mc.reverse()
+ return remove_list_if_one_element([_[0] for _ in mc])
+
+
+def dedup_list(lst: List[Any]) -> List[Any]:
+ """
+ Remove duplicates from the list performantly.
+
+ >>> dedup_list([1, 2, 1, 3, 3, 4, 2, 3, 4, 5, 1])
+ [1, 2, 3, 4, 5]
+
+ """
+ return list(set(lst))
+
+
+def uniq(lst: List[Any]) -> List[Any]:
+ """
+ Alias for dedup_list.
+ """
+ return dedup_list(lst)
+
+
+def contains_duplicates(lst: List[Any]) -> bool:
+ """
+ Does the list contian duplicate elements or not?
+
+ >>> lst = [1, 2, 1, 3, 3, 4, 4, 5, 6, 1, 3, 4]
+ >>> contains_duplicates(lst)
+ True
+
+ >>> contains_duplicates(dedup_list(lst))
+ False
+
+ """
+ seen = set()
+ for _ in lst:
+ if _ in seen:
+ return True
+ seen.add(_)
+ return False
+
+
+def all_unique(lst: List[Any]) -> bool:
+ """
+ Inverted alias for contains_duplicates.
+ """
+ return not contains_duplicates(lst)
+
+
+def transpose(lst: List[Any]) -> List[Any]:
+ """
+ Transpose a list of lists.
+
+ >>> lst = [[1, 2], [3, 4], [5, 6]]
+ >>> transpose(lst)
+ [[1, 3, 5], [2, 4, 6]]
+
+ """
+ transposed = zip(*lst)
+ return [list(_) for _ in transposed]
+
+
+def ngrams(lst: Sequence[Any], n):
+ """
+ Return the ngrams in the sequence.
+
+ >>> seq = 'encyclopedia'
+ >>> for _ in ngrams(seq, 3):
+ ... _
+ 'enc'
+ 'ncy'
+ 'cyc'
+ 'ycl'
+ 'clo'
+ 'lop'
+ 'ope'
+ 'ped'
+ 'edi'
+ 'dia'
+
+ >>> seq = ['this', 'is', 'an', 'awesome', 'test']
+ >>> for _ in ngrams(seq, 3):
+ ... _
+ ['this', 'is', 'an']
+ ['is', 'an', 'awesome']
+ ['an', 'awesome', 'test']