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

 

james.shockey@austinisd.org > LASA_moveSeats
prev  |  next  |  chance

A new grading period has started and one teacher would like to shift their seating arrangement so the students are sitting somewhere new. The teacher has numbered then chairs in the room from 0 to n − 1 so they can be represented as an array of size n.

Your task is to take an array of n int values representing the students and shift the entire array right by 1 (that is, the element at any position i moves to position i + 1, except element n − 1, which should move to position 0). Assume that n > 1.


LASA_moveSeats([1, 2, 3, 4, 5]) → [5, 1, 2, 3, 4]
LASA_moveSeats([4, 9, 16]) → [16, 4, 9]
LASA_moveSeats([7, 3, 5, 9, 2, 0]) → [0, 7, 3, 5, 9, 2]

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

public int[] LASA_moveSeats(int[] chairs) { }

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