Skip to content

Instantly share code, notes, and snippets.

View shkesar's full-sized avatar

shubham shkesar

View GitHub Profile
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
def nQueens(n: Int) = (0 until n).permutations filter {p =>
val i = p.zipWithIndex.toSet // p[i] is the column of the queen on ith row (must be a permutation of 0 until n)
i.map{case (c, d) => c + d}.size == n && // No 2 queens can have same col + diag
i.map{case (c, d) => c - d}.size == n // No 2 queens can have same col - diag
}
for {
(solution, num) <- nQueens(8).zipWithIndex
_ = println(s"Solution #${num + 1}:")
col <- solution