Cyclic Rotation Task Again, this is a simple task: Write a function: vector<int> solution(vector<int> &A, int K); that, given an array A consisting of N integers and an integer K, returns the array A rotated K times. Solution You just calculate the previous index of each element and populate the answer accordingly #include <iostream> using […]
Month: April 2020
Binary Gap Task This is a simple task: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. You simply have to find the length of the maximum run of zeros in the binary representation of […]
Codility Lessons Solutions Codility is a company that provides testing of candidates coding skills. Essentially their site asks the applicant to write a function to perform a task, then runs unit tests against the answer. There is a post about their site here. They also provide a set of tasks that anyone can take and […]
Codility – First Thoughts
Overview So a potential client asked me to take a test at the Codility site. This is a site that does an automated test of candidate’s coding skills. It basically asks you to write a function to perform a task, then runs unit tests against your function. They provide a demo, this is a very […]