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
| ==== Starting Array State ==== | |
| [4 7 3 2 8 9 3 1] | |
| ==== Permutations of Array ==== | |
| [4 7 3 2 8 9 3 1] | |
| [3 4 7 2 8 9 3 1] | |
| [2 3 4 7 8 9 3 1] | |
| [2 3 4 7 8 9 3 1] | |
| [2 3 4 7 8 9 3 1] | |
| [2 3 3 4 7 8 9 1] | |
| [1 2 3 3 4 7 8 9] |
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
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| func main() { | |
| array := []int{4,7,3,2,8,9,3,1} | |
| for i:=1; i<len(array); i++ { | |
| for j:=i; j>0 && array[j-1]>array[j]; j-- { |
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
| package main | |
| import ( | |
| bcrypt "golang.org/x/crypto/bcrypt" | |
| "fmt" | |
| ) | |
| func main() { | |
| password := []byte("password123") | |
| fmt.Println("Creating hashword") |
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
| #!/bin/python3 | |
| import sys, math | |
| t = int(input().strip()) | |
| for a0 in range(t): | |
| n = int(input().strip()) | |
| factor_list = [] | |
| while (n % 2 == 0): | |
| factor_list.append(2) |
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
| FermatFactor(N): // N should be odd | |
| a ← ceil(sqrt(N)) | |
| b2 ← a*a - N | |
| while b2 is not a square: | |
| a ← a + 1 // equivalently: b2 ← b2 + 2*a + 1 | |
| b2 ← a*a - N // a ← a + 1 | |
| endwhile | |
| return a - sqrt(b2) // or a + sqrt(b2) |
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
| #!/bin/python3 | |
| import sys | |
| t = int(input().strip()) | |
| for a0 in range(t): | |
| n = int(input().strip()) | |
| s = 0 | |
| previous_fibonacci = 0 |
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
| #!/bin/python3 | |
| import sys | |
| t = int(input().strip()) | |
| for a0 in range(t): | |
| n = int(input().strip()) |
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
| #!/bin/python3 | |
| import sys | |
| t = int(input().strip()) | |
| for a0 in range(t): | |
| n = int(input().strip()) |
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
| #!/bin/python3 | |
| import sys | |
| import math | |
| t = int(input().strip()) | |
| for a0 in range(t): | |
| n = int(input().strip()) | |
| n=n-1 | |
| sumd = 0 | |
| sumd += (5*((math.floor(n/5)*(math.floor(n/5)+1))//2)) |
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
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| ) | |
| func get_page_source(url string) string { | |
| response, error := http.Get(url) |