Remove duplicates from an unsorted list; for example, [1,2,1,2,3] becomes [1,2,3] because the 1 can only be repeated once, the 2 can only be repeated once, and the 3 is only repeated once. Use cases here are especially in streaming and processing idempotent data, such as that in unreliable networks where packets or messages may be sent multiple times.

Make a pure-functional queue using Scala's Map. It would have the following methods: isEmpty: Boolean, enqueue(T), dequeue: Option[(T, Queue[T])].

Make a pure-functional queue using stacks (Lists). It would have the following methods: isEmpty: Boolean, enqueue(T), dequeue: Option[(T, Queue[T])].

The single-elimination tournament is popular in team games.

Find the longest length of valid parentheses in a string. For example, in '((())()', the maximum length is 6 because '(())()' forms the longest valid parentheses sequence.

This is a variation of BinarySearch, where the input array is rotated (RotateArrayRight).

Find combinations of an array that sum up to N, where numbers are unique.

Reimplement the 'String#indexOf' Java function.

Reverse the bits of an integer, eg 2 becomes 1073741824 as 2 is 0b[30 times of 0-bit]10, so 2 reversed is 0b01[30 times of 0-bit].

Find k closest elements to a value in a sorted Array. Assume no duplicates.

Turn an m-by-n matrix into an n-by-m matrix, retaining the order of the elements. For example: Becomes:

In Streaming data, data may come in duplicated; it could be due to various factors such as duplicated data from sources and idempotency for redundancy; for consumption though we may need to deduplicate the data for at-most-once processing.

In Streaming data, data may come in duplicated; it could be due to various factors such as duplicated data from sources and idempotency for redundancy; for consumption though we may need to deduplicate the data for at-most-once processing.

Find combinations of an array that sum up to N. Numbers are not unique.

909 sums to 18, which sums to 9. Find the best way to compute it for any positive n, efficiently.

Add two numbers without using addition (+ sign). Can be done with bitwise operations. For example, 5 + 3 is 8; in binary it is 101 + 011 = 1000.

In Tic Tac Toe (also known as Naughts and Crosses), players place an X or an O onto a 3x3 grid. The winner is the player who gets three of their own in a row/column/diagonal.

In a Pascal's triangle, a number in a row is created by adding the two numbers directly above it; the first row is contains only 1, and the second row contains 1 and another 1.

Given a letter such as C, print a diamond using letters A to C, for example:

Efficiently, reverse a String's words. For example, 'Hello new world' becomes 'world new Hello'.

In a distributed system, we wish to monitor processes which may succeed or fail; if a process fails too often, we should kill it.

The QuickSelect Selection algorithm finds the kth smallest item in a collection. It it related to QuickSort.

Rotate a matrix by 90 degrees, ie what was the first row going left-to-right becomes the last column top-to-bottom. For example, Becomes:

For a matrix, read it in a clockwise spiral order. For example, if this is the matrix: Would be read as:

Given a grid of colors describing a map of countries, where a contiguous blob of colour represents a country, count the number of countries on the map.

The longest common substring is shared between two Strings. For example: 'XYZzz' and 'ddXYZdd' has common substring 'XYZ', which is of length 3.

Find the minimum missing positive number in a sequence. For example, [-3,-2] has no minimum missing positive as 1.

A binary search finds the index of a target item in a sorted array. The goal is to implement the algorithm using pure-functional Scala.

Run-length encoding is one of the most basic compression methods, which is especially useful where there long runs of a particular character or a group of characters.

Run-length encoding is one of the most basic compression methods, which is especially useful where there long runs of a particular character or a group of characters.

In an array, find the contiguous slice that has the minimum average. For example, [3, 1, 9, 1, 2] has slices:

In Tic Tac Toe (also known as Naughts and Crosses), players place an X or an O onto a 3x3 grid. The winner is the player who gets three of their own in a row/column/diagonal.

Find the minimum absolute difference of partitions in an Array:

Roman numerals originated from the Etruscan numerals system, which inspired the Roman numeral symbols:

Quick sort is a standard merging algorithm, and uses a similar divide-and-conquer approach to MergeSortStackSafe. Where it differs is that it works around a pivot.

The Fibonacci sequence is 0, 1, 1, 2, 3, 5, 8, 13, 21, ..., ie F(n + 2) = F(n + 1) + F(n), with F(1) = 1 and F(0) = 1.

In a range \(5\) to \(15\), there are \(4\) numbers divisible by \(n = 3\): \(6\), \(9\), \(12\) and \(15\).

A permutation of an array \(X\) is another array of the same size, which has the same elements.

Merge Sort is a standard merging algorithm. It works by grouping items into pairs, and then merging those pairs by selecting the smallest items in ascending order.

From a set of coordinates, find the pair that are the closest to each other. (Looking forMergeSortStackSafe?)

The number of inversions in a sequence is the number of pairs of elements that are out of order, ie\(|{(i, j) : i < j, A_i > A_j}|\)

Rotating the array [1,2,3] by 1 element to the right returns an array [3,1,2]. Example:

A number y is a factor of x if x is divisible by y. Find the number of distinct factors of a number x.

Merge Sort is a standard merging algorithm. It works by grouping items into pairs, and then merging those pairs by selecting the smallest items in ascending order.

In a sequence, find the length of the longest increasing sub-sequence.