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

  • Home
  • SEARCH
  • 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 3665218
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:44:06+00:00 2026-05-19T01:44:06+00:00

I am not asking for the solution. I want all the possible placements.

  • 0

I am not asking for the solution. I want all the possible placements.

  • 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-19T01:44:06+00:00Added an answer on May 19, 2026 at 1:44 am

    The below code is in C#. Hope it helps

        static void Main(string[] args)
        {
            Program obj = new Program();
            StreamWriter saveText = new StreamWriter("Output.txt",true);
            obj.fourQueen(0, 0, 4, "");
            Console.Read();
    
        }
    
    
        public void fourQueen(int r , int c, int queensLeft, string onePlacement){
            if(queensLeft == 0){
                //onePlacement may not be a answer
                Console.WriteLine(onePlacement);
            return ;
    
            }
    
            if(c==4){
                //If I have reached the end of 1 row, go to next one
                c=0;
                r=r+1;
            }
            if(r==4){
                //I have considered all rows and still not put all queens. cannot be a solution
                return;
            }
            int te = queensLeft - 1;
    
    
    
    
    
    
            int newcol = c + 1;
            fourQueen(r,newcol,te,onePlacement+"| ("+r+","+c+")|");
            //Note: As i am placing queen in (r,c) above, there is no point in continuing //recursive call from r,c+1 as cannot place another in same row. I should
            //go from  r+1,0
            fourQueen(r,newcol,queensLeft,onePlacement);
    
    
        }
    }
    

    }

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

Sidebar

Related Questions

Perhaps I am not asking or searching for this correctly: I want to have
I'm just looking for ideas/suggestions here; I'm not asking for a full on solution
Can anybody offer a solution to the above? For now, all i want to
I'm not asking about converting a LaTeX document to html. What I'd like to
I'm not asking this question because of the merits of garbage collection first of
Note that I am not asking which to choose (MVC or MVP), but rather
[I'm not asking about the architecture of SO, but it would be helpful to
I know I'm not asking this quite right, either. Please help me better form
I'm not really asking about how programmers learn how to program. More about specific
I'm not really asking whether I should use either a RDBMS or config files

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.