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 primeNumbers(n int, pChan chan int) { | |
defer close(pChan) | |
for i := 2; i <= n; i++ { | |
prime := true |
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 flip(n int) int { | |
var v int | |
for n != 0 { //to make it cater for negative numbers | |
remainder := n % 10 | |
v = v*10 + remainder | |
n /= 10 |
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 solution() int { | |
var min int | |
num := 21 | |
found := false | |
for !found { | |
var clean bool |
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 solution(limit int) int { | |
sum, ssq := 0, 0 | |
for i := 1; i <= limit; i++ { | |
square := i * i | |
ssq += square | |
sum += i |
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 solution(index int) int { | |
num, counter, val := 2, 0, 0 | |
for { | |
var clean = true | |
for i := 2; i <= num-1; i++ { |
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 ( | |
"bufio" | |
"database/sql" | |
"fmt" | |
"os" | |
"strconv" | |
_ "github.com/lib/pq" |
OlderNewer