FastPrepGenerate Circular Student Arrangements
Problems/Generate Circular Student Arrangements

Generate Circular Student Arrangements

Amazon logoAmazon● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Amazon Experience 24 asks you to generate every ordering of students, and then turns the line into a circle. It was an onsite interview. The report does not say when two circles count as the same, or what order the output has. Here, we remove turned copies by fixing the smallest student first. A mirror image counts as a different clockwise order. The output is in lexicographic order. Our version is about 88% the same as the reported question.

The distinct identifiers in students must be seated around a circle. Two arrangements are considered the same if one can be rotated to obtain the other. Reflections are different because clockwise neighbor order changes.

Return every distinct circular arrangement. Serialize one arrangement by starting with the lexicographically smallest student and joining the clockwise identifiers with >. Return the serialized arrangements in lexicographic order.

Function

circularStudentArrangements(students: String[]) → String[]

Examples

Example 1

students = ["Ada","Ben","Cam"]return = ["Ada>Ben>Cam","Ada>Cam>Ben"]

Fixing Ada first leaves the clockwise orders Ben-Cam and Cam-Ben.

Example 2

students = ["Zoe","Amy"]return = ["Amy>Zoe"]

After rotations are merged, two students have one circular arrangement.

Example 3

students = ["d","b","a","c"]return = ["a>b>c>d","a>b>d>c","a>c>b>d","a>c>d>b","a>d>b>c","a>d>c>b"]

Anchoring a and permuting the other three students produces six results.

Constraints

  • 1 <= students.length <= 8.
  • Identifiers are distinct nonempty alphanumeric strings of length at most 12.
  • Identifiers do not contain >.

More Amazon Onsite Interview questions

  • Number of IslandsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Cheapest Flights Within K StopsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dungeon GameONSITE INTERVIEW · Seen Nov 2026
  • Integer BreakONSITE INTERVIEW · Seen Nov 2026
  • LFU CacheONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Count Adjacent Symbol Pairs for BPEONSITE INTERVIEW · Seen Nov 2026
  • First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Partition into Equal-Sum GroupsPalo Alto Networks · ONSITE INTERVIEWPalo Alto Networks interview questions
  • Bounded Combination Sum with Signed CandidatesConfluent · ONSITE INTERVIEWConfluent interview questions
  • Count Triplets With Sum at Most TargetGoogle · ONSITE INTERVIEWGoogle interview questions
  • Reduce Array Size to At Most HalfMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Enumerate Character Paths to a MarkerTesla · ONSITE INTERVIEWTesla interview questions
  • Subsets IIBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Inventory Outfit CombinationsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Enumerate Compatible Meeting SubsetsExpedia · ONSITE INTERVIEWExpedia interview questions
  • PermutationsEPAM · PHONE SCREENEPAM interview questions
  • Permutations IILinkedIn · PHONE SCREENLinkedIn interview questions

Interview reports that mention this question

  • Amazon New Grad SDE Onsite Interview Questions: 17 Experiences

Amazon interview experiences

  • Amazon SWE OA with AI Coding: 1 Experience
  • Amazon SWE Intern Phone Screen Interview Experience: 1 Experience
  • Amazon New Grad SDE I OA and Virtual Onsite: 1 Experience
  • Amazon BIE Intern SQL and Interview Questions: 17 Experiences
  • Amazon Experienced SWE AI-Assisted Debugging OA: 1 Experience
See Amazon hiring insights
Saved
class Solution {
    public String[] circularStudentArrangements(String[] students) {
      // write your code here
    }
}
Checking account…