Skip to content

Algo-problems for fast and efficient time complexity

Notifications You must be signed in to change notification settings

Co-Science/Fast-Algo-probs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast-Algo-probs

Algo-problems for fast and efficient time complexity

Time Calculation in go
package main

import (
	"fmt"
	"time"
)

func elapsed(what string) func() {
	start := time.Now()
	return func() {
		fmt.Printf("%s took %v\n", what, time.Since(start))
	}
}

func main() {
	defer elapsed("page")() // <-- The trailing () is the deferred call
	time.Sleep(time.Second * 2)
}