Skip to content

Instantly share code, notes, and snippets.

@sholfen
Created November 9, 2015 00:37
Show Gist options
  • Save sholfen/04033d0d67dcccc56ed5 to your computer and use it in GitHub Desktop.
Save sholfen/04033d0d67dcccc56ed5 to your computer and use it in GitHub Desktop.
for Codility: FrogJmp
using System;
// you can also use other imports, for example:
// using System.Collections.Generic;
// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");
class Solution {
public int solution(int X, int Y, int D) {
// write your code in C# 6.0 with .NET 4.5 (Mono)
int distance = Y - X;
int steps = distance / D;
if(distance % D != 0)
{
steps += 1;
}
return steps;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment