Friday, September 19, 2014

Develop your skills with Codility

As a programmer, is a good tool that provide the programmers and developers a good chance to develop their programming skills. It provides programming lessons, readings and monthly interesting challenges for problems to solve in many programming languages such as Java, C#, C and others.
I believe that all of us should keep an eye on such arithmetic and mathematical problems that depends on the way you implement them using your preferred programming language so you can implement them correctly and efficiently. Beside considering the scientific evaluation for your code through considering time and efficiency complexity. This would help refreshing our minds in the way we implement different business problems and requirements in a way or another.
I have gone through some of its lessons that you can find in this link beside the readings they provided with the lessons. Each lesson contains some tasks that you can go through them to test your skill and develop them.
The first task of the first lesson is a Frog Jump problem . It was a good kick start to start that. You can find my solution implementation for it bellow.

class Solution {
 public static int solution(int x, int y, int d) {
  if (!(x <= y) || x == y) {
   return 0;
  if (x >= 1 && x <= 1000000000 && y >= 1 && y <= 1000000000 && d >= 1
    && d <= 1000000000) {
   int result = (y - x) % d;
   if(result == 0) {
    return (y - x) / d;
    return ((y - x) / d) + 1;
  return 0;


No comments:

Post a Comment