Given an array of integers print out the largest difference between two adjacent numbers. For the array [4,8,3], 8-3 would be the largest difference.
Given an array of integers print out the largest difference between two adjacent numbers. For the array [4,8,3], 8-3 would be the largest difference.
Permalink: http://problemotd.com/problem/largest-difference/
Content curated by @MaxBurstein
Comments:
Anonymous - 10 years, 1 month ago
reply permalink
Anon - 10 years, 1 month ago
Java:
reply permalink
Anonymous - 10 years, 1 month ago
C#
reply permalink
Jordan - 10 years, 1 month ago
Here's the javascript version of this!
var array = [4, 10, 20, 30, 50, 67, 4, 20]; var len = array.length; var high = 0;
for (i = 0; i < len || function(){ alert(high); return false;}(); i += 2){
}
function largest_diff(x, y){
}
jsfiddle here:
http://jsfiddle.net/rryw8abo/9/
reply permalink
Jordan - 10 years, 1 month ago
Javascript:
http://jsfiddle.net/rryw8abo/10/
reply permalink
Driphter - 10 years, 1 month ago
Clojure!
C#!
reply permalink
Anonymous - 10 years, 1 month ago
Cool did not know about the zip method in c#
reply permalink
Nick - 10 years, 1 month ago
Javascript:
reply permalink