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

 

frew@mclean.com > isSorted
prev  |  next  |  chance

Write a method named isSorted accepts a stack of integers as a parameter and returns true if the elements in the stack occur in ascending (non-decreasing) order from top to bottom, else false. That is, the smallest element should be on top at the head, growing larger toward the bottom at the tail. An empty or one-element stack is considered to be sorted. You may use one stack as auxiliary storage.


isSorted([42]) → true
isSorted([]) → true
isSorted([20, 20, 17, 11, 8, 8, 3, 2]) → true

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

public boolean isSorted(ArrayList<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

Difficulty: 300

Copyright Nick Parlante 2017 - privacy