Тёмный
No video :(

Create a Sudoku Solver In Java In 20 Minutes - Full Tutorial 

Coding with John
Подписаться 350 тыс.
Просмотров 319 тыс.
50% 1

Complete Java course: codingwithjohn...
Source code here: www.codingwith...
Let's create a Sudoku solver in Java!
Sudoku is a logic game, where you fill in numbers from 1-9 in a 9x9 grid. In Sudoku, each row, column, and 3x3 sub-grid must contain all numbers from 1-9.
Solving Sudoku in Java seems like it could be complicated - and some of it certainly is! But I'll break down the Java program for solving Sudoku into more simple pieces that we'll code together.
Learn or improve your Java by watching it being coded live!
Hi, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java developers.
Let me know what else you'd like to see!
Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
📕 THE best book to learn Java, Effective Java by Joshua Bloch
amzn.to/36AfdUu
📕 One of my favorite programming books, Clean Code by Robert Martin
amzn.to/3GTPVhf
🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
www.audibletria...
🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
bit.ly/3QPNGko
📹Phone I use for recording:
amzn.to/3HepYJu
🎙️Microphone I use (classy, I know):
amzn.to/3AYGdbz
Donate with PayPal (Thank you so much!)
www.paypal.com...
☕Complete Java course:
codingwithjohn...
codingwithjohn...

Опубликовано:

 

12 май 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 344   
@19joni69
@19joni69 2 года назад
Making a sudoku solver was actually the very first project I programmed once I'd learned the basics. This takes me back.
@yahia1355
@yahia1355 2 года назад
Wow ! I have been coding for arround 5 years and could'nt come up with a solution!
@19joni69
@19joni69 2 года назад
@@yahia1355 oh I didn't do anything smart. I literally brute forced a solution. Basically going over every single square and trying the first number that works, then if I got to one that had no possible correct number I would go back until the first square that I could have put a different number in and tried the different number. Do that until you can fill every square correctly. Just literally trying every combination until it works. There are much better ways to solve this. But the not so smart solution works.
@user-cg4vi4kn4v
@user-cg4vi4kn4v 4 месяца назад
@@19joni69 🤣🤣😂
@clo-1588
@clo-1588 2 года назад
You're an excellent teacher, John. I find your videos not only extremely helpful, but impressively well-made - and it's not even so much about the format (which is ideal), but the way you teach and the examples you give. You explain things in a logical, progressive way, and you're excellent at providing the right level of exposure. I do wish there were more teachers like you in universities - but then, we might not have you on RU-vid ;) Please keep going with these tutorials, you are contributing to the community in a huge way.
@stormybear4986
@stormybear4986 2 года назад
This was, legitimately, the most interesting java tutorial I've seen in years! EXCELLENT!!!!!
@krishnawadhwani5393
@krishnawadhwani5393 2 года назад
I had recently discovered this channel, haha, and I started to watch your videos on TV Like I am watching some movies or some kind of entertainment, nice videos keep it up, subscribed after watching 2-3 videos
@MykhailoZubanych
@MykhailoZubanych 2 года назад
Same)
@janekk3397
@janekk3397 Год назад
I'm so glad channels like this one exist. It was a part of my project and I would've never figured that out myself...
@penguin7863
@penguin7863 Год назад
Sir before I watch your video I was a student who was struggling to solve recursion problems for my upcoming test. Now I get the idea about how to backtrack in recursion :) Huge thanks from South Korean student!
@nikhilraov100
@nikhilraov100 2 года назад
This program works perfectly. What a flawless algorithm you have written .
@jagi7976
@jagi7976 2 года назад
It’s beautiful when something that’s educational is also entertaining
@Nikolai4567
@Nikolai4567 2 года назад
I didn't think this solution would have an adequate time complexity. Thanks!
@mthsffc
@mthsffc Год назад
This is exactly what I was looking for to complement my java studies. Projects with step-by-step explained. Please, keep it going, unfortunately here on RU-vid, everything seems to be only JavaScript or Python. It would be great more projects with OOP.
@sharadgupta8576
@sharadgupta8576 2 года назад
It was just really awesome and in so nice way u described it's just really wow... M so surprised why just so less likes I have watched couple of videos before but u just explained really understanding with gotcha learn some new concept as well successfully found my final year project as well thanks for making this video... I will surely check out your more videos.. Great job 👍
@luigiq6429
@luigiq6429 3 года назад
Great video John. Congrats on 500 subs!
@CodingWithJohn
@CodingWithJohn 3 года назад
Thanks!!
@CodingWithJohn
@CodingWithJohn 2 года назад
Well at least I've certainly gone well past 500
@techtonight882
@techtonight882 2 года назад
I think we can use dynamic programming too, to reduce some of the complexity. We can use a HashMap to store if a number at particular position was a valid placement or not.
@kesarscorpio
@kesarscorpio 2 года назад
i guess this one is for beginners and that's why he chose this way of doing it
@cs0576
@cs0576 2 года назад
But that is dependent on the previous placements. So I do not immediately see how that improves this algorithm.
@smrtfasizmu6161
@smrtfasizmu6161 2 года назад
The argument of the hashmap needs to be both the board and the placement of the number. How does backtracking in your algorithm work? I am not sure how you intended to do it with hashmaps and make the code less complex than what you saw in this video. Can you elaborate further? One idea popped up in my mind, but it is more or less a copy of what you saw in the video but without recursion. First you have an array which holds the position which are given in the beginning. Then, you proceed filling in the board and every time you find out that you can't continue filling in the board you backtrack the i and j variables of the loop until you reach the next number which you filled in and continue trying filling it after setting number To Try to be 1+the previous numberToTry.
@mr.mirror1213
@mr.mirror1213 2 года назад
iirc the whole problem is a system of linear equation , and u can solve it in O(n) if u use multigrid method
@JannisAdmek
@JannisAdmek 2 года назад
You teaching skills are really impressive, great work! I have one minor point to critique, you hardcoded GRID_SIZE 9 but used 3 as a magic number. You could have computed it once sqrt(GRID_SIZE) or just declared it as a constant.
@Michael-se7ny
@Michael-se7ny 2 года назад
sqrt(GRID_SIZE) would make no sense at all
@JannisAdmek
@JannisAdmek 2 года назад
@@Michael-se7ny Really? Doesn't a Sudoku box always have side length of sqrt(GRID_SIZE)? But I guess the really clean way would be to define the sudoku in terms of the BOX_SIZE, since GRID_SIZE has to be square number. so a normal sudoku is BOX_SIZE = 3. (GRID_SIZE = BOX_SIZE * BOX_SIZE)
@p_varma17
@p_varma17 2 года назад
@@JannisAdmek right
@saviobatista9619
@saviobatista9619 2 года назад
Thank you! Amazing video, where I work I tried several times create something to solve our work schedule with some kind of algorithm but always fail, this was just exactly what I needed and hope to solve my needs. Thank you!
@rajeshg3570
@rajeshg3570 2 года назад
This is excellent .. i simply love the naming conventions of the vars..which makes its easy to read and understand the logic
@jhuluan-jyun2594
@jhuluan-jyun2594 2 года назад
No wonder you’re a lead! Very clear sir, thank you
@mdrwsh
@mdrwsh 2 года назад
it is amazing to see various algorithms that be used to solve sudoku, i made one but using while loop
@olayiwolaakinnagbe676
@olayiwolaakinnagbe676 Год назад
This is the best video I found online for this problem. You are a great teacher, thank you.
@michaelkraemerman2009
@michaelkraemerman2009 Год назад
This was such a good explanation!!! I feel a lot more confident about implementing this. Also thanks for not acting like this is easy/obvious👏
@jefersonlerma5743
@jefersonlerma5743 Год назад
Pretty nice explanation. I made one sudoku solver but try to improve his performance using a priotityQueue. Basically save in the queue the empty spaces that can take the minimun posible values, so.. the queue delivery the spaces that have less probablity to change... and i reorder the probability of the other spaces that have been afected for add a new number in ther matrix. This consume so much memory but less time...
@CodingWithJohn
@CodingWithJohn Год назад
Interesting methodology! This definitely isn't the most efficient way to do it but the board is limited to 9x9, so even with a terrible time complexity any board is still solved pretty quickly
@manusoftar
@manusoftar 2 года назад
I think that those nested for loops on the solve method are unecesary, you could add two additional params to send the current row and column and inside the function you just would need to either add the the rows or to the column depending on what you are doing... yes you will have to put some IF's, but the way you did it I think it will do unnecesary iterations, I mean, the last recursive call on a solvable board will put the needed number but there's nothing that would stop the initial call to the solve method from stopping it's iterations. Actually, on each recursive call it will have to traverse as far as possible on the board until sending back a false or a true if solved. You don't need the algorithm to traverse almost the whole board on each recursive call, you just need it to make a single step on the board instead.
@joekagerer
@joekagerer 2 года назад
I wrote a Sudoku solver in 2008 in Javascript, but it didn't quite use full recursion (my mistake) so it wouldn't solve moderately difficult puzzles. Mine includes character recognition of uploaded websuduko puzzles. This week I added "paste from clipboard" so that I didn't have to save/load my puzzle images. Today, following your model I finally got mine solving even the "evil" puzzles. Thank You John for this great lesson. Although now I don't feel that "I wrote the code", my page works and I did right the optical character recognition parts. I don't believe that I can share a link here, but I can try.
@Bury11
@Bury11 2 года назад
cool project :) i'm fairly new to java, i programmed a small snake'ish game, so i understood the 2d array way better then i thought :D keep up the good work!
@RomualdBrunet
@RomualdBrunet 2 года назад
Using static methods and passing the board as parameter hurts my brain for some reason (vs using the board as an instance of a class)
@ae6072
@ae6072 5 месяцев назад
same! Why doesnt he use the board as an instance? Is there any special reason for this?
@kunalkheeva
@kunalkheeva 2 года назад
How did you make it so simple, I always appreciate your content. your content is limited on youtube but whenever I get stuck in any problem and you have a video on that, which means, my last destiny is your video. Thank you
@surjansr
@surjansr 2 года назад
Great explanation. Will be great if we can also talk about the time complexity of the solutions
@robertoborelli3275
@robertoborelli3275 2 года назад
It's like O(k*10^(k^2 -n)) where k is the number of cells in a row and n is the number of placed numbers at the start. If you try with k greaters than 9 this algorithm would literally take years to find a solution. You can do better using sat solvers and translating the sudoko problem into cnf logical formulas.
@smrtfasizmu6161
@smrtfasizmu6161 2 года назад
@@robertoborelli3275 may I ask why do you have zero in the beginning of the expression 0(k * 10^(k^2 - n)) doesn't it just cancel everything to zero? Also, why do you have 10 to the power of cells to solve, how did you get 10? Did you mean k because with every added unsolved cell you need k times more traversing the loops (assuming that the number of rows = the number of digits you can fill a cell in) ? And why do you have k * in the beginning of the expression?
@robertoborelli3275
@robertoborelli3275 2 года назад
@@smrtfasizmu6161 it's been a while since I've watched the video and now I don't remember exactly the code but here I give you some explanations: 1) It's not a 0, but is a big O. This thing is called "Big O notation". Simplifying, you can read it as "the complexity is less or equal than..." but there are some formal and accurate mathematical definitions behind this intuition I gave. 2) The intuition behind the formula is that this code is clearly exponential in the number of unsolved cells (k^2 - n). 3) each time you call the function to see if a number is valid in cell you spend O(k) time. 4) For each cell there are (exactly) k possible values (in the case of normal sudoku k is 9). So to sum the important thing here are: - exponential in the number of unsolved cells. - you take linear time in k, each time you check if a number is valid So as I wrote in the previous comment this is a pretty easy solution to write and implement but it's very inefficient since it uses the technique 'guess and verify'. It's much better (but also a bit more difficult) to use a sat solver for this kinds of problems.
@juanmalpartida1333
@juanmalpartida1333 2 года назад
Time complexity looks to be O(n^3) worst case. Average, eyeballing it, I would say is n^2*log(n)
@robertoborelli3275
@robertoborelli3275 2 года назад
​@@juanmalpartida1333 no. just because you have 3 nested loops you can't always say that you have O(n^3). Inside this loop there is a recursion! This solution is exponential for sure, infact there are situations in which you guessed j correct values, than you are trying to fill the j+1-th value and you discover that there is no such a solution. In this case the algorithm does "backtracking" and there are situations in which all the j guessed valuesare wrong and the algorithm must re guess the entire solution. This leads to exponential cost!
@footballalliance2412
@footballalliance2412 3 года назад
Hi John, i have learned a lot from your videos. I hope you won't stop making videos in upcoming days, it is really helpful for us. I can guarantee you will get a huge subscribers in coming days.
@CodingWithJohn
@CodingWithJohn 3 года назад
Thanks! Glad you're getting something out of them. I'll keep making them if people keep watching them!
@razvanungureanu8897
@razvanungureanu8897 Год назад
I have reached the part where I didn't find a solution to erase the all the numbers of the board and to retry. I know it needed some recursion, but didn't figure out how. Your explanation was excellent and after reviewing your method, everything makes sense. Thanks and keep it up with these kind of videos!
@qurdedu4032
@qurdedu4032 Год назад
Great explanation and great mini project Thank you so much. Looking for more project like this
@wombozombo
@wombozombo Год назад
Fun way to learn about recursion 👍
@JonasKeil
@JonasKeil 2 года назад
This tutorial is excellent John.
@navyathamarreddy2807
@navyathamarreddy2807 Год назад
very nicely explained John, I saw few other videos as well for Sudoku Solver, but this is amazing!
@b9944236
@b9944236 Год назад
Now I can solve it by myself, thanks a lot.
@carlostitlan
@carlostitlan Год назад
Your explanaition is soo cool! You even make feel this stuff is easy.
@josueramirez7247
@josueramirez7247 2 года назад
In an intro to programming textbook I own, it mentions in the preface that one difference from prior printings is that it removes the sudoku solver example code from the multidimensional arrays chapter because apparently is it too complex at that point.
@EminentInception94
@EminentInception94 2 года назад
Plumber, fireman, astronaut, father, and son. Now a JavaScript developer? Johnny Sinns has truly outdone himself
@CodingWithJohn
@CodingWithJohn 2 года назад
I'm a man of many talents
@Pennervomland
@Pennervomland 2 года назад
I‘d love to see this exact algorithm but more efficient. Knuths Algorithm X for sudoku sounds very interesting and shows a pretty good method for backtracking. I‘m too dumb to understand how to implement it in java but it could be a cool challenge for you.
@northnorth9913
@northnorth9913 2 года назад
I like what you doing, Hope you get the chance to do Dijkstra’s algorithm, Time complexity and a few more interview related. I like your explanations
@PathWars
@PathWars 2 года назад
Awesome, exactly the kind of RU-vid channel I wanted: Regularly uploaded coding videos.
@dragondog3180
@dragondog3180 2 года назад
You don't need an else in "if (solveBoard(board)) " as you don't have to set board[row][column]to 0. It will just be reset to another number when it immediately after is assigned a new number in the for loop. It is only if the for loop fails that you need to set it to 0.
@jaimesastre6393
@jaimesastre6393 2 года назад
Oh, yes. Right. It just makes it clear for us maybe.
@Leo_banana
@Leo_banana 2 года назад
So, “board[row][column] = 0” can be moved to the place before return false For more informations, It must be one of these places, right?
@fandusmercius723
@fandusmercius723 2 года назад
wouldn't having it there cause elimination of 1 possibility while going for previously placed index?
@dragondog3180
@dragondog3180 2 года назад
@@Leo_banana That is correct.
@dragondog3180
@dragondog3180 2 года назад
@@fandusmercius723 It wouldn't.
@sweetysojrani9323
@sweetysojrani9323 Месяц назад
Awesome algorithm. It would be nice, if you could also explain the time complexity of the algorithm in your video.
@vivekjj2986
@vivekjj2986 2 года назад
Thanks so much John. I spent a lot of time searching on youtube for a good tutorial on this. I wish yours was the first video so i could have saved time :(
@tonyz2203
@tonyz2203 2 года назад
OMG, I understand how to solve this complex problem now. Thank you so much!
@amaralensheriff
@amaralensheriff Год назад
As always, thank you John.
@jaydoshi5394
@jaydoshi5394 2 года назад
Watching couple of videos from this channel every day in any order. But still makes sense
@ChristForAll-143
@ChristForAll-143 2 года назад
Simply Nailed It, AWESOME EXPLANATION
@shintaromidorima1552
@shintaromidorima1552 Год назад
it is 100% working teacher john and thank you for the source code
@siddhantanand5751
@siddhantanand5751 2 года назад
Hey, John I loved the way you went forward with explaining the video , you made it quite easy to learn the algorithm and fun too, i was curious if we can attach some image recognition tools like OpenCV etc for Java , so that we can scan a sudoku at run time and give an image back? I would love if you could show us how to do this if you like the idea.
@Garrison86
@Garrison86 2 года назад
Amazing! Thanks for this, this helps me stay engaged in java
@verruu333
@verruu333 2 года назад
if you could make a short tutorial about binary search trees and how to understand recursion there..
@francescopiazza4882
@francescopiazza4882 2 года назад
Great coding John! I got a "Hard Sudoku" solved in a few ms !
@surajverma-ut4kj
@surajverma-ut4kj Год назад
Just one word for John 🙏🏼 Big ThankYou ❣️
@ulyses1018
@ulyses1018 Год назад
Great video! Thanks for this kind of tutorials John! :D
@staceyonuora5329
@staceyonuora5329 3 года назад
Great video, I really enjoyed your explanation. Super thanks, this was very helpful
@abdurrouf4159
@abdurrouf4159 2 года назад
You just nailed it. Mind blowing tutorial, no doubt.
@abigailpinkus2183
@abigailpinkus2183 Год назад
Thank you. I have a question. When solving how the algorithm works, you came up with the part where if it goes through the numbers and places, for example, 3, and 3 works, then it moves on. In the condition that it goes to the next location and is not successful, how did you come up with that it goes back to the previous number and tries again? What about the condition where it places 3 but the problem is 4 spaces away? What happens in the algorithm?
@hunterdmayo
@hunterdmayo Год назад
"What about the condition where it places 3 but the problem is 4 spaces away? What happens in the algorithm?" I had the same question. Here is my understanding. The algorithm sets for board[row][col] the first number that it finds (from 1-9) that is a valid placement. It does this even if that number is not ultimately correct. The problem could come from the very next empty square, as in the video, or it could come from a square much farther away on the board, as you point out. When the algorithm places a number in a square that was valid (when placed) but that is not correct, it will later reach a point where it is unable to find a valid number for a subsequent square (call that square i). When this happens, the current invocation of solveBoard will return false, causing the previous square (square i-1) to be reset to 0 and the numToTry for that square (square i-1) to be incremented and the search continued. If a valid placement cannot be found for square i-1 (e.g., because it was already correct), that invocation will also return false. This process of returning false will cascade backwards as the search continues to find valid placements for squares, resetting previously set squares to 0 and continuing the search from earlier locations in the board. So, when the algorithm hits a point at which, using the board in its current state, it cannot solve the puzzle, it backtracks to try other values in previous squares, working in a kind of "forward and backwards" way.
@rams2478
@rams2478 2 года назад
WOW.. you are amazing....clean.. detailed.. explanation. Please do Leetcode problems also.. It will help us.
@jamesdepoorter726
@jamesdepoorter726 2 года назад
Hello John, why didn't you use TDD in this example? This could be a nice addition, because it constantly keeps the code in check
@kingsuley0581
@kingsuley0581 10 месяцев назад
Loved this!
@bartomiejpotaman6973
@bartomiejpotaman6973 8 месяцев назад
Shit took me a while but I think that's why it was worth it. This video made recursion seem so much more intuitive. Thank you!
@alzaeem79
@alzaeem79 Год назад
Beautifully well explained, thank you sir.
@mynameispooop
@mynameispooop Год назад
Awesome Tutorial
@kondasandeep6615
@kondasandeep6615 2 года назад
Can I give a little suggestion in it In IsNumberInBox() method we can write row = ( row / 3 ) * 3; Instead of row = row - row % 3; Same thing for column also
@AdamantlyAdams
@AdamantlyAdams 2 года назад
Bro, thank you for teaching. You are the go to guy!
@stabilini
@stabilini 2 года назад
I made once a Sudoku solver en Excel using Visual Basic using a more human like strategy... placing various plausible numbers in each empty space, and recursevly eliminating invalid ones
@CodingWithJohn
@CodingWithJohn 2 года назад
I did the same in Python in AI class in college. I think that's a cooler solution, but I liked the simplicity that this one offered for someone newer to coding, for purposes of this video
@sigfigronath
@sigfigronath 2 года назад
This was really nice, fun and informative!
@mohammadsadrayeganehfaal2323
such a enjoyable algorithm!!!
@abidoyevictor2780
@abidoyevictor2780 3 года назад
Well explained! Thanks John
@dipanshuasri
@dipanshuasri Месяц назад
Hi John, what should be the strategy to follow your tutorial. Shall we understand it first whole ? then we should code or should we code parallel ?
@nagasivakrishna5660
@nagasivakrishna5660 Год назад
wow,next level explanation
@zimbabwe8189
@zimbabwe8189 3 года назад
Great video, your explanation was pretty clear!
@alpaslanbek
@alpaslanbek 2 года назад
It violated every clean code principle I know :D
@pendax
@pendax 2 года назад
What is the design process that leads to this design? In the video, the thinking is already done. I'd like to hear about the thinking.
@javawocky
@javawocky Год назад
Very nice. I do this stuff for fun. Recently did one of those word search generators which you see kids books all the time. Way more interesting to do than you may initially think.
@sujay_hegde
@sujay_hegde 2 года назад
Wouldn't a better design be to embrace OOPS for what it is, and make Board an object with members Row and Column
@christophermcdermit3828
@christophermcdermit3828 Год назад
It is clearly just a fancy excuse to make a fiercly overpowered recusion process, basically like a 90's batch file. Have you found anyone who made an actual OOPS solver, because I want to watch that if you know where one is?
@Gandobilis
@Gandobilis Год назад
Very interesting tutorial!
@alexnovik6223
@alexnovik6223 2 года назад
1. You return only one solution. 2. It's the brute force method instead of a logical solution. But it finally works !! I try to make a smart solution with the possible value exclusion method. It's more interesting in my opinion ))
@Maddin1989yo
@Maddin1989yo 2 года назад
Great and concise explanation! When this video was suggested, I found it hard to believe that this was doable in a beginner friendly way in only 20 minutes, well done! I have one suggestion though: If you have the GRID_SIZE as a static final int, the box size (3, as used as a magic number in isNumberInBox(...) and print(...)) should be, too! Probably it should be initialized as the square root of GRID_SIZE, or vice versa.
@obitouchiha7545
@obitouchiha7545 2 года назад
Wow sir you can explain things very well, let aside being multitasker.
@yash1152
@yash1152 Год назад
9:51 > _"we clear that out & keep trying reat of the numbers between 1 & 9"_ Time Complexity: O( n ^ 5 ) or O( n ^ 6 ) right??
@user-ou1ir7zq8o
@user-ou1ir7zq8o 9 месяцев назад
I learn more in 1 video than in 2 months worth of other tutorials
@ol_gr
@ol_gr 2 года назад
the algorithm sounds violently inefficient, but still a cool solution to a complex problem
@estebanlegare
@estebanlegare Год назад
Really helpful!
@jaimesastre6393
@jaimesastre6393 2 года назад
Wow, great. So clear. I especially appreciate the backtrack! So clever, just a 0 and then the loop moves on at the point it stopped, so we get the next possible number that fits in the location. Continue with examples like this. It's excellent.
@CodingWithJohn
@CodingWithJohn 2 года назад
Thanks! Let me know if you have any ideas for programs like this. It's tough because they have to be complex enough to be interesting but small enough to fit in a reasonable video.
@jaimesastre6393
@jaimesastre6393 2 года назад
@@CodingWithJohn yes, thanks. I just bought a book about Ai and python where they also take small projects that can perfectly fit to your devs. There is the classic 8puzzle, The shortest way, Snake, Tetris, Spam search, And I don't know how you say in English : O|X|O _|X|O O|X|_
@jaimesastre6393
@jaimesastre6393 2 года назад
@@CodingWithJohn pack man is more complex but can maybe make a video for the moves?
@KrINekroN
@KrINekroN 2 года назад
maybe to continue sudoku solver in next part , about add interface , textbox for enter numbers which we wanna change..etc
@sanchitghai1455
@sanchitghai1455 2 года назад
I like that you also play binding of issac 🙂. As for the program I loved it. It was well made video for beginners and one can't not understand the concept. Keep it up! 👍
@Darya-pu6ik
@Darya-pu6ik 2 года назад
its fantastic, i really like the way you teach, its intresting! However, could we do it using DP or is the an NP?
@codegeek8256
@codegeek8256 2 года назад
Please make a video on the Hand Of Poker (Poker Hands) Game, it seems to be used alot on interview assessments this days. I am sure alot of people need it.
@user-sr7ht8rm6r
@user-sr7ht8rm6r 10 месяцев назад
John, thank you for everything! Could you maybe make a video on backtracking specificaly? That would be awesome! :)
@abubakaradamu6278
@abubakaradamu6278 3 года назад
I think, i just found my best youtuber. Keep up the good work John.
@patrickbradley4948
@patrickbradley4948 2 года назад
Same
@joshcanton90
@joshcanton90 2 года назад
Would it be useful to create the board as a static class-level variable so you don't need to pass it into every method you call?
@voorth
@voorth 2 года назад
That, or make the board an instance variable (which you could inject with a constructor) - and make all methods instance methods....
@guidopiotrowski7900
@guidopiotrowski7900 2 года назад
Thanks for the great explanation! Keep it up with the channel!
@paweziemba5736
@paweziemba5736 2 года назад
You use constans for grid size, why don't this same for box size? E.g. if you change to sudoku 12x12 with box 4x4 ?
@RoysIdea
@RoysIdea 2 года назад
This can then also be used for printing the horizontal and vertical lines. Printing numbers greater than 9, could then continue with capitals.
@RoysIdea
@RoysIdea 2 года назад
And I assume you would then do a 16x16 with box 4x4, as the number of digits in a row, column and box need to be equal. Thus a 12x12 could have a box of 4x3 or 3x4.
@ralfmanthey7540
@ralfmanthey7540 2 года назад
I like that video - it's really cool. I did nearly the same 2weeks ago, when I implemented the 8 queens riddle forthe coming girls-day in our company ....
@RealRogerFK
@RealRogerFK 2 года назад
Interesting, I expected a lot of OOP concepts applied with its own Board class and 7 methods for each little thing. Still cool video to learn but it truly surprises me someone so devout to Java didn't fill a class with methods and functional programming stuff. Also I bet people struggling with for loops (yes, they do exist...) and recursion would find this very helpful
@ponder2406
@ponder2406 2 года назад
Wow! That’s so cool! This was an awesome video! Very interesting :)
@strawberrykitty8337
@strawberrykitty8337 4 месяца назад
thank you so much!!!!!
@spidernh
@spidernh 2 года назад
I didn't use the tutorial but after seeing some of it I decided to try it myself without any help and this strategy worked, only issue was that my loop variable went from 0-8, so if a number was 9 then it failed
@wetsox278
@wetsox278 2 года назад
I was thinking about that as I was watching it, wondering if it was going to capture the 9, being that it is 0 indexed.
@neeldiyora3575
@neeldiyora3575 Год назад
Excellent explanation 👏👏👏
Далее
Generics In Java - Full Simple Tutorial
17:34
Просмотров 1 млн
Python Sudoku Solver - Computerphile
10:53
Просмотров 1,2 млн
아이스크림으로 진짜 친구 구별하는법
00:17
Мелл хочешь сына от Дилары
00:50
Просмотров 257 тыс.
5 Simple Steps for Solving Any Recursive Problem
21:03
A Sudoku Genius Recommended A Puzzle...
50:03
Просмотров 50 тыс.
The Most Brutal Chess Slaughter Of August 13 2024
10:08
Cocky Childhood Friend Thinks He Can Beat Me in Chess
20:06
Tic Tac Toe Game in Java - Full Tutorial with Source
51:39
아이스크림으로 진짜 친구 구별하는법
00:17