From the course: Code Clinic: Swift

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Find solutions

Find solutions - Swift Tutorial

From the course: Code Clinic: Swift

Start my 1-month free trial

Find solutions

- [Instructor] If we run the application right now and head over to the debug window, you'll actually see a list of all of the different permutations of our array. Remember, this gives us all of the possible solutions that just include horizontal and vertical solutions. So what we do is we take this list, we check to see if the solution is a diagonal solution, and if so, we save it in our solutions array. So I'm going to stop the application, minimize the debug area and go inside of our permute worth method. Now, inside of if n is equal to zero, print a, this is where we found a solution, so we want to add it to our solutions array, but only if it actually is a solution. So, call if is solution, passing a, and if it is, we'll call solutions got append, and then we'll pend a. So now what we have to do is write the code that checks to see if it's actually a solution. So remember, we've already handled horizontal and vertical solutions, we just need to handle diagonal solutions. So…

Contents