This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FrogJump { | |
public int solution(int Y, int X, int D) { | |
/* | |
* jump_distance is the value | |
* jumps the number of jumps can be calculated by dividing the jump distance by the number of jumps, | |
* this won't calculate the total number of jumps, this can be calculated by using modulus, if there is a | |
* remainder 1 is added to the total number of jumps. | |
*/ | |
int jump_distance = (Y - X), | |
jumps = (jump_distance / D) + ((jump_distance % D > 0) ? 1 : 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A non-empty zero-indexed array A consisting of N integers is given. Array A represents numbers on a tape. | |
Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]. | |
The difference between the two parts is the value of: |(A[0] + A[1] + ... + A[P − 1]) − (A[P] + A[P + 1] + ... + A[N − 1])| | |
In other words, it is the absolute difference between the sum of the first part and the sum of the second part. | |
For example, consider array A such that: | |
A[0] = 3 | |
A[1] = 1 | |
A[2] = 2 | |
A[3] = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TapeEquilibrium { | |
public int solution(int[] A) { | |
/* | |
* Declare some initial variables | |
* min is the maximum value an Integer could possibly be. (each element of array A is an integer within the range [−1,000..1,000].) | |
* total will represent the total value of each element in A | |
* upto will be used to represent the left hand side of the Array | |
*/ | |
int min = 9999, | |
total = 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TapeEquilibrium { | |
public int solution(int[] A) { | |
/* | |
* Declare some initial variables | |
* min is the maximum value an Integer could possibly be. (each element of array A is an integer within the range [−1,000..1,000].) | |
* total will represent the total value of each element in A | |
* upto will be used to represent the left hand side of the Array | |
*/ | |
int min = 9999, | |
total = 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule pagespeed_module> | |
ModPagespeed off | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch(var) { | |
case 1: | |
doSomething(); | |
break; | |
case 2: | |
doSomethingElse(); | |
break; | |
default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Protect the jQuery alias, $, from other Javascript libraries by extending it within a protected scope. | |
(function($) { | |
// Extend the jQuery library using the name of you plugin, in this case 'pluginName' | |
$.fn.pluginName = function(options) { | |
// Extend the options (a Javascript object) parameter with the default options declared further below | |
var $opts = $.extend({}, $.fn.pluginName.options, options); | |
// Public method (see below) | |
$.fn.pluginName.somePublicMethod(); | |
NewerOlder