Solution to Codility lesson4-exercise3 Distinct problem, link to Codility problem and complete solution at the end of the post. Definitions: Problem: Define a function solution with input A , such that solution returns the number of distinct values in array A. Expected worst-case time complexity is O(N*log(N)); Expected worst-case space complexity is O(N), […]

# Codility – Triangle

Solution to Codility lesson4-exercise2 Triangle problem, link to Codility problem and complete solution at the end of the post. Definitions: A triplet is triangular if and: A[P] + A[Q] > A[R], A[Q] + A[R] > A[P], A[R] + A[P] > A[Q]. Just like in the Max Product of Three problem, […]

# Codility – Max Product of Three

Solution to Codility lesson4-exercise1 Max Product of Three problem, link to Codility problem and complete solution at the end of the post. Definitions: Product: Product of three elements of A, , such that . Notice that saying that , it’s the same that saying that the elements can’t be […]