From the course: Go Essentials: Concurrency, Connectivity, and High-Performance Apps
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Solution: Find the maximal value - Go Tutorial
From the course: Go Essentials: Concurrency, Connectivity, and High-Performance Apps
Solution: Find the maximal value
(upbeat music) - [Instructor] Here is my solution. I've commented out the printing of the numbers. We initialized max with the first number, so this is nums at zero location, and then, I'm using a slicing notation to start from the second value in the follow-up. I'm using underscore in value to get just the values since I don't care about the indexes. And if the current value is bigger than max, I'm assigning max to this value, and finally, printing out the maximal value. And when we run it, we see that we get 42.
Contents
-
-
-
-
Numbers and assignments3m 52s
-
(Locked)
Conditionals2m 35s
-
(Locked)
For loops2m 5s
-
(Locked)
Challenge: FizzBuzz57s
-
(Locked)
Solution: FizzBuzz55s
-
(Locked)
Strings2m 59s
-
(Locked)
Challenge: Even-ended numbers55s
-
(Locked)
Solution: Even-ended numbers53s
-
(Locked)
Slices2m 34s
-
(Locked)
Challenge: Find the maximal value12s
-
(Locked)
Solution: Find the maximal value41s
-
(Locked)
Maps2m 37s
-
(Locked)
Challenge: Maps26s
-
(Locked)
Solution: Maps57s
-
-
-
-
-
-
-
-