Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:22:27+00:00 2026-06-05T20:22:27+00:00

Say I have a table that goes clockwise like this: 2 1 3 0

  • 0

Say I have a table that goes clockwise like this:

   2
1      3
   0

This works fine in a 4 person game, but in a 3 person game, the server does not see a 4th chair. Thus, I must map 3 players, one of whom may sit at seat [3] to an array of 3 [2] elements.

So if players were sitting at 2,3,0 then 2 maps to 0, 3 maps to 1 and 0 maps to 2. If the seating was 1, 3, 0 it would map 1 to 0, 3 to 1, and 0 to 2.

What would be a good algorithm to do this if I wanted a std map for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:22:27+00:00Added an answer on June 5, 2026 at 8:22 pm

    Assuming you have an ordered structure of the seats, and making a few assumptions because the details of your implementation are not clear:

    std::map<int, int> clockwisePositionMap;
    int counter = 0;
    for (Seat s : seatList) {
        if(s.isOccupied()) {
            clockwisePositionMap.insert( pair<int, int>(seat.getNumber(), counter));
            counter++;
        }
    }
    

    Note that this does not match either of your examples; it always gives 0 first precedence, but you can change the for loop as necessary if that is a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a MySQL table that is something like this: software table:
Lets say I have one table called REVIEWS This table has Reviews that customers
Say I have a table that has a column which goes: Column B apple
Say I have a User model in JavaScript that looks something like this: var
I have a procedure that goes like this: create or replace PROCEDURE NEWJOBIDPROC (JOB_ID
I have a sql exception from clojure that goes like this: java.lang.Exception: transaction rolled
Let's say I have a table that has user_id, date, score, and every user
Say I have a simple table that contains username, firstname, lastname. How do I
So let's say I have a compound index on a table that indexes 4
Lets say I have a table in MySQL called articles, that has a column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.