Given 2n counters where n > 1. You have to place these 2n counters on an n à n board so that no more than two counters are in the same row, column, or diagonal. Solution : Since we need to place 2n counters into n rows and n columns of the given n x n board, with the condition that there can be at most two counters in the same row or in the same column. From this , we can conclude that exactly two counters have to be placed in each row and column. Case 1 : For even n = 2k, we can obtain a solution by identical placement of n counters in the first k columns and the last k columns as explained below. Let us assume that rows and columns of the board are numbered top to bottom and left to right, respectively. Place two counters in the first two rows of columns 1 and k + 1, two counters in rows 3 and 4 of columns 2 and k + 2, and so on, until finally counters are placed in rows n – 1 and n of columns k and 2k. Let us understand this with the help of an example when n = 8 :

2n Counters problem for n = 8
Case 2 : For odd n = 2k + 1, k > 0, we can obtain a solution by placing two counters in rows 1 and 2 of column 1, two counters in rows 3 and 4 of column 2, and so on until counters are placed in rows n – 2 and n – 1 of column k. Then two counters are placed in the first and last rows of column k + 1. After that, k counters are placed in the right part of the board symmetrically with respect to the boardâs central square to those in the left part: two counters are placed in rows 2 and 3 of column k + 2, in rows 4 and 5 of column k + 3, and so on, until rows n – 1 and n of the last column.Let us understand this with the help of an example when n = 7 :

2n counters problem for n = 7
References : Algorithmic Puzzles â Anany Levitin, Maria Levitin
Learn to code easily with our course
Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated :
18 Jan, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...