All Questions
4 questions
4
votes
1
answer
2k
views
Swift - Finding longest binary gap of a given integer
I recently had the chance to try Codility's algorithm training, and the very first one in the list is finding the longest binary gap of a given integer.
I tried to implement this in Swift, and after ...
5
votes
2
answers
8k
views
Find the number of K-Complementary pairs in an array
Below is the program to find k-complementary pairs: K = A[i] + A[j];.
...
3
votes
3
answers
9k
views
Intersection of subset between two lists of dicts
I want to find the intersection of two lists of dicts.
Note that equality—i.e.: what is to appear in the intersection—is given by which keys they must have equal. See the ...
2
votes
3
answers
2k
views
Find intersection of two arrays without duplicates
A = [9, 1, 4, 2, 5] k unique integers
B = [3, 1, 8, 7, 6, 5] n unique integers
Intersection => [1, 5]
Find an algorithm that uses \$O(1)\$ space (the space used by the return variable is not ...