Skip to content

Instantly share code, notes, and snippets.

View derekkenney's full-sized avatar

Derek Kenney derekkenney

  • goPuff
  • Philadelphia
View GitHub Profile
@derekkenney
derekkenney / README.md
Last active May 31, 2020 23:40
Count distinct number of ints from a list of 1 million ints.

Solution for counting the distinct number of ints from an array of one million ints

@derekkenney
derekkenney / README.md
Last active July 5, 2019 16:57
An example of implementing binary search in Go

Binary Search implementation in Go

  • $ go run main.go Returns a bool if the search value was found or not

A solution to the common interview question of finding odd numbers between two ints

Implemented as a simple REST API

Example

Flatten a mutlidimensional array of nested int arrays into a one dimensional array

An example application that flattens nested int arrays into a single int array

Components

Testing

The application uses Go's standard package 'testing'. The test fixtures are setup before each test run

  • cd ./arrays
  • go test -v
@derekkenney
derekkenney / big-o-linear.go
Last active January 28, 2019 14:33
Finding the linear run-time of a Go function
package main
import "fmt"
//Create an array with a length of 10k
var galaxy [10000]string
var bigO int
//Worst case scenario. Have to go through 10k records
func findDagobah() {
@derekkenney
derekkenney / big-o-quadratic.go
Last active May 30, 2020 02:49
Example of Determining Quadratic Runtime of a Go Function
package main
import "log"
var planets1 = []string{"Tattooine", "Dantooine", "Bespin", "Yavin4"}
var planets2 = []string{"Exegol", "Jeda", "Jakku", "Mustafa", "Yavin4"}
var searches = 0
func main() {