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 7619877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:48:01+00:00 2026-05-31T03:48:01+00:00

I have a list of objects that have coordinates. The object is something like

  • 0

I have a list of objects that have coordinates. The object is something like this:

private class Seats
{
    public string Code { get; set; }
    public long PosX { get; set; }
    public long PosY { get; set; }
}

For all Seats inside the list, I need to know that they are in group of 4, in a horizontal row. For example, the list below is fine:

List<Seats> good = new List<Seats> {
    new Seats {Code = "A1", PosX = 0, PosY = 0},
    new Seats {Code = "A2", PosX = 1, PosY = 0},
    new Seats {Code = "A3", PosX = 2, PosY = 0},
    new Seats {Code = "A4", PosX = 3, PosY = 0}
};

The list below is also OK (two rows):

List<Seats> good = new List<Seats> {
    new Seats {Code = "A1", PosX = 0, PosY = 0},
    new Seats {Code = "A2", PosX = 1, PosY = 0},
    new Seats {Code = "A3", PosX = 2, PosY = 0},
    new Seats {Code = "A4", PosX = 3, PosY = 0},
    new Seats {Code = "B1", PosX = 0, PosY = 1},
    new Seats {Code = "B2", PosX = 1, PosY = 1},
    new Seats {Code = "B3", PosX = 2, PosY = 1},
    new Seats {Code = "B4", PosX = 3, PosY = 1}
};

The list below is also OK (same row, two groups, gap at (4,0)):

List<Seats> good = new List<Seats> {
    new Seats {Code = "A1", PosX = 0, PosY = 0},
    new Seats {Code = "A2", PosX = 1, PosY = 0},
    new Seats {Code = "A3", PosX = 2, PosY = 0},
    new Seats {Code = "A4", PosX = 3, PosY = 0},
    new Seats {Code = "A6", PosX = 5, PosY = 0},
    new Seats {Code = "A7", PosX = 6, PosY = 0},
    new Seats {Code = "A8", PosX = 7, PosY = 0},
    new Seats {Code = "A9", PosX = 8, PosY = 0}
};

But the list below is not OK because there is a gap at (3,0):

List<Seats> bad1 = new List<Seats> {
    new Seats {Code = "A1", PosX = 0, PosY = 0},
    new Seats {Code = "A2", PosX = 1, PosY = 0},
    new Seats {Code = "A3", PosX = 2, PosY = 0},
    new Seats {Code = "A5", PosX = 4, PosY = 0}
};

The list below is also not OK because there are five of them:

List<Seats> bad2 = new List<Seats> {
    new Seats {Code = "A1", PosX = 0, PosY = 0},
    new Seats {Code = "A2", PosX = 1, PosY = 0},
    new Seats {Code = "A3", PosX = 2, PosY = 0},
    new Seats {Code = "A4", PosX = 3, PosY = 0},
    new Seats {Code = "A5", PosX = 4, PosY = 0}
};

The list below is also not OK because the four Seats need to be in a horizontal row:

List<Seats> bad3 = new List<Seats> {
    new Seats {Code = "A1", PosX = 0, PosY = 0},
    new Seats {Code = "A2", PosX = 1, PosY = 0},
    new Seats {Code = "B1", PosX = 0, PosY = 1},
    new Seats {Code = "B2", PosX = 1, PosY = 1}
};

For checking multiplication of 4 (it can be 8, 12, …) I can just do:

list.Count % 4 == 0

But I need help in how to check ‘in a row’.

  • 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-05-31T03:48:02+00:00Added an answer on May 31, 2026 at 3:48 am

    Split all values in lists per Y value.

    Then for each split list:

    • Check that all Y values are equal.
    • For X values: Iterate through the list, and check if the difference with the previous is equal the the previous and before previous (check if items exist).

    Assuming the points are in order (as in your example), at least for X coordinate.

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

Sidebar

Related Questions

I have a list of objects that I've created manually, like this: rand1 <-
I have a class that contains a list of objects. What's the best way
I have a class Player that contains a list of Accessory objects. There are
I have a class that has an list<Book> in it, and those Book objects
I have a List of objects that extend another class: List<? extends Fruit> arguments;
I have an list of objects that contains another object in it. List<MyClass> myClass
I have a List of objects that I would like to convert to a
I have a list of objects that have two int properties. The list is
I have a list of Python objects that I want to sort by a
I have a list/collection of objects that may or may not have the same

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.