id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

countDepthIncreases


Problem: Oceanographer - Depth Changes

A team of oceanographers is analyzing ocean depth data to determine trends in underwater currents. They need your help to count how often the ocean depth increases from one measurement to the next.

Write a Java method countDepthIncreases(int[] depths) that takes an array of integers representing depth measurements and returns the number of times a measurement is greater than the previous one.


countDepthIncreases([199, 200, 208, 210, 200, 207, 240, 269, 260, 263]) → 7
countDepthIncreases([100, 99, 98, 97, 96]) → 0
countDepthIncreases([150, 155, 160, 165, 170]) → 4

...Save, Compile, Run (ctrl-enter)

public int countDepthIncreases(int[] depths) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Copyright Nick Parlante 2017 - privacy