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

 

tmhscs@gmail.com queues > queue_consecutiveOrder
prev  |  next  |  chance

Given a queue of integers, return true if all of the integers are in consecutive order counting up OR if all of the integers are in consecutive order counting down. Consecutive order increasing means that the next value is exactly one value higher than the previous. Consecutive order decreasing means that the next value is exactly one value lower than the previous.


queue_consecutiveOrder([1, 2, 3, 4]) → true
queue_consecutiveOrder([4, 3, 2, 1]) → true
queue_consecutiveOrder([2, 4, 6, 8]) → false

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

public boolean queue_consecutiveOrder(List<Integer> list) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy