Created
October 22, 2017 15:37
-
-
Save krishna2nd/67c9f8a3f48f16254aa82fd2bebb13e9 to your computer and use it in GitHub Desktop.
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 main() { | |
| var val = []int{ 1,2 ,3 ,4 ,115 ,6 ,17 ,8 ,9 }; | |
| var l1, l2 int = val[0], 0; | |
| for _, v := range val { | |
| if (l1 < v) { | |
| l2 = l1 | |
| l1 = v | |
| continue; | |
| } | |
| if (l2 < v && l2 < l1) { | |
| l2 = v; | |
| } | |
| } | |
| fmt.Println(l2) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment