This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findNextSquare(sq) { | |
// Optimal solution | |
// return Math.sqrt(sq)%1? -1 : Math.pow(Math.sqrt(sq)+1,2); | |
// Return the next square if sq if a perfect square, -1 otherwise | |
var curVal = Math.sqrt(sq) + 1 | |
var nextSq = Math.sqrt(sq) + 1 | |
nextSq *= nextSq | |
//console.log(sq) | |
//console.log(currentNumber) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="apple-touch-icon" href="apple-touch-icon.png"> | |
<link rel="stylesheet" href="css/normalize.min.css"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div { | |
height: 100px; | |
background-color: red; | |
background-image: | |
linear-gradient( | |
45deg, | |
#7BB9CF, | |
#848DD0, | |
#AC01CC, | |
#CD00A9, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... | |
* The next number is found by adding up the two numbers before it. | |
* - The 2 is found by adding the two numbers before it (1+1) | |
* - Similarly, the 3 is found by adding the two numbers before it (1+2), | |
* - And the 5 is (2+3), and so on | |
*/ | |
// Using recursion | |
function fibonacciNumberOf(number) { |
NewerOlder