Skip to content

Instantly share code, notes, and snippets.

View jakmir's full-sized avatar
🇺🇦
Focusing

Denis Melnik jakmir

🇺🇦
Focusing
  • Ukraine, Kyiv
View GitHub Profile
import Foundation
import UIKit
class Node<T>: CustomStringConvertible {
let value: T
var next: Node<T>?
init(value: T, next: Node<T>? = nil) {
self.value = value
self.next = next
/*
Sliding Puzzle
*/
class Node<T> {
let value: T
var next: Node<T>?
init(with value: T, next: Node<T>? = nil) {
self.value = value
@jakmir
jakmir / n-queens-problem.swift
Created May 1, 2021 23:01
N-Queens-Problem
/// Place N queens on the chessboard. As a result, no two queens are attacking each other.
enum QueenPuzzleSolverError: Error {
case negativeSize
}
class QueenPuzzleSolver {
private var route: [Int] = []
private var solutionList: [[Int]] = []