Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 493 Bytes

README.md

File metadata and controls

33 lines (24 loc) · 493 Bytes

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)
}