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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:37:48+00:00 2026-05-11T08:37:48+00:00

Given an array of 81 elements (meant to represent a 9×9 grid) how can

  • 0

Given an array of 81 elements (meant to represent a 9×9 grid) how can I go over each element, grabbing the three around it and then performing an operation on those, then continuing to the next three of each row, column, or submatrix. Look below or at a sudoku grid to see the layout.

 define COL(n)      ((n) % 9) define ROW(n)      ((n) / 9) define SUB(n)      ((n / 3) % 9) 

For example, I have

 int grid[81]; 

and

 int array_x[9], array_y[9], array_s[9]; 

Since the total 9x9 grid can be split into 9 of the following categories, there are nine elements in each array, and I hope to take the elements of each column (the x axis) in groups of threes, perform

 r = ((a = ~a) & (b = ~b)) | ((b | a) & ~c);  // or  r = ((~a & ~b)) | ((~b | ~a) & ~c); 

on them, take the three resultant numbers, and perform it on them, and then store it into the array.

If this sounds impossible, sorry, I'd like a different way to do this. Definitely open to suggestions...

  • 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. 2026-05-11T08:37:49+00:00Added an answer on May 11, 2026 at 8:37 am

    Another try:

    void applyThingy(int *grid, int xPitch, int yPitch) {     int row, column;     int *rowPointer = grid;      for(row = 0; row < 3; ++row)     {         int *columnPointer = rowPointer;          for(column = 0; column < 3; ++column)         {             doOperation(columnPointer);             columnPointer += xPitch;         }          rowPointer += yPitch * 9;     } }  applyThingy(&grid[SUB(n)], 1, 1); // Perform on 3x3 subgrid applyThingy(&grid[ROW(n)], 1, 0); // Perform on row applyThingy(&grid[COL(n)], 0, 1); // Perform on column 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 140k
  • Answers 140k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think both of them work. With the second solution,… May 12, 2026 at 7:50 am
  • Editorial Team
    Editorial Team added an answer One test case = one condition to be tested, some… May 12, 2026 at 7:50 am
  • Editorial Team
    Editorial Team added an answer For 100000 elements, the Python code took 6.9 seconds while… May 12, 2026 at 7:50 am

Related Questions

Given an array of 81 elements (meant to represent a 9x9 grid) how can
Given an array of n Objects, let's say it is an array of strings
Given an array of characters which forms a sentence of words, give an efficient
Given an array of integers, what is the simplest way to iterate over it
Given an array of items, each of which has a value and cost ,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.