Implemented as a simple REST API
- $ go run main.go
- $ curl http://localhost:8080/api/oddnumbers/1/10 Returns an array of odd numbers in the range
An example application that flattens nested int arrays into a single int array
The application uses Go's standard package 'testing'. The test fixtures are setup before each test run
- cd ./arrays
- go test -v
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" | |
//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() { |
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 "log" | |
var planets1 = []string{"Tattooine", "Dantooine", "Bespin", "Yavin4"} | |
var planets2 = []string{"Exegol", "Jeda", "Jakku", "Mustafa", "Yavin4"} | |
var searches = 0 | |
func main() { |