Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: A question about counting solutions to a sudoku Matrix with recursion

  1. #1
    Junior Member
    Join Date
    Oct 2022
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default A question about counting solutions to a sudoku Matrix with recursion

    Hello, new to the forum. Thanks for having me.

    I've implemented a backtracking algorithm to find a single solution to a matrix. Which is represented as an int[][].

    It currently finds the same solution on the same input.

    What I want to do:
    To count the amount of solutions to an input matrix.
    Fx. the empty matrix:
    0 0 0 0
    0 0 0 0
    0 0 0 0
    0 0 0 0
    has 288 unique solutions, because 4! * 3! * 2! *1! = 288.

    What my problem is:
    My current attempt returns 64. And I can not really see what I am doing wrong.

    Hopefully somebody strong in recursion can help me track this down, or easily spot what I'm doing incorrectly.[COLOR="Silver"]

    --- Update ---

    https://pastebin.com/yYYc4Wgm
    Last edited by nnn; October 20th, 2022 at 07:50 PM.

Similar Threads

  1. Recursion: Fibonacci Number Question
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 14th, 2013, 04:07 AM
  2. Help with turning Sudoku into Magic Sudoku
    By Murlio in forum Java Theory & Questions
    Replies: 1
    Last Post: November 4th, 2012, 02:49 PM
  3. Need help with a part in a recursion LinkedList question
    By ZenithX in forum Algorithms & Recursion
    Replies: 3
    Last Post: November 2nd, 2011, 05:17 AM
  4. question about recursion..
    By gonfreecks in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 16th, 2011, 09:51 AM
  5. Question: counting
    By miss confused in forum Java Theory & Questions
    Replies: 2
    Last Post: July 30th, 2010, 05:38 PM

Tags for this Thread