Categories
coding solutions

Codility: CommonPrimeDivisors Solution

Task Check whether two numbers have the same prime divisors.: A prime is a positive integer X that has exactly two distinct divisors: 1 and X. The first few prime integers are 2, 3, 5, 7, 11 and 13. A prime D is called a prime divisor of a positive integer P if there exists […]

Categories
coding solutions

Codility: NailingPlanks Solution

Task The task is to count the minimum number of nails that allow a series of planks to be nailed.: You are given two non-empty arrays A and B consisting of N integers. These arrays represent N planks. More precisely, A[K] is the start and B[K] the end of the K−th plank. Next, you are […]

Categories
coding solutions

Codility: FibFrog Solution

Task The task is to search for the optimal solution to a problem involving summing Fibonacci numbers: A small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position −1) and wants to get to the other bank (position N). The frog […]

Categories
coding solutions

Codility: count_semiprimes Solution

Task The task is to Count the semiprime numbers in the given range [a..b]: A prime is a positive integer X that has exactly two distinct divisors: 1 and X. The first few prime integers are 2, 3, 5, 7, 11 and 13. A semiprime is a natural number that is the product of two […]

Categories
coding solutions

Codility: Peaks Solution

Codility: Peaks Solution Task Divide an array into the maximum number of same-sized blocks, each of which should contain an index P such that A[P – 1] < A[P] > A[P + 1]].: A non-empty array A consisting of N integers is given. A peak is an array element which is larger than its neighbors. […]

Categories
coding solutions

Codility: Count Factors Solution

Codility: Count Factors Solution Task The task is to Count factors of given number n.: A positive integer D is a factor of a positive integer N if there exists an integer M such that N = D * M. For example, 6 is a factor of 24, because M = 4 satisfies the above […]

Categories
Uncategorized

A proposal for a simple cryptocurrency

A proposal for a simple cryptocurrency This is a look at an new way of creating a cryptocurrency as an alternative to blockchains. tldr A protocol can be designed for transferring payments across the internet, it requires some degree of prior trust of at least some peers. Incorporating transaction fees in the protocol reduces the […]

Categories
coding productivity writing

Keyboard Profiling in Vim

Keyboard profiling means capturing statistics about the timing of keypresses while someone is typing. It can be used to improve a users touch-typing technique, among other benefits. This post covers using a vim script that can record keyboard profiling data while you use vim normally.

Categories
coding solutions

Codility MaxDoubleSliceSum Solution

MaxDoubleSliceSum Solution Task The task is a variation of the Maximum subarray problem found in the max slice sum task: A non-empty array A consisting of N integers is given. A triplet (X, Y, Z), such that 0 ≤ X < Y < Z < N, is called a double slice. The sum of double […]

Categories
coding solutions

Codility: MaxSliceSum Solution

MaxSliceSum solution Task The task is to maximise the sum of a subsequence of an array. A non-empty array A consisting of N integers is given. A pair of integers (P, Q), such that 0 ≤ P ≤ Q < N, is called a slice of array A. The sum of a slice (P, Q) […]