Go

How to SHA256 a String in Golang

If you need to SHA256 a String in Go, then you can use the crypto/sha256 package. SHA256 a String in Go The output will look… Read More »How to SHA256 a String in Golang

How to Base64 Encode/Decode in Golang

Go ships with an encoding/base64 package that allows for encode and decoding of Base64 strings. Import the base64 package and then start using it! Base64… Read More »How to Base64 Encode/Decode in Golang

Irreducible Sum of Rationals in Golang

The challenge You will have a list of rationals in the form: where all numbers are positive integers. You have to produce their sum N /… Read More »Irreducible Sum of Rationals in Golang

How to Calculate Dominant Primes in Golang

The challenge The prime number sequence starts with: 2,3,5,7,11,13,17,19…. Notice that 2 is in position one. 3 occupies position two, which is a prime-numbered position. Similarly, 5, 11 and 17 also occupy prime-numbered positions. We shall… Read More »How to Calculate Dominant Primes in Golang

How to Solve Simple Square Numbers in Golang

The challenge In this challenge, you will be given a number n (n > 0) and your task will be to return the smallest square number N (N >… Read More »How to Solve Simple Square Numbers in Golang

How to perform Function Iteration in Golang

The challenge The purpose of this challenge is to write a higher-order function returning a new function that iterates on a specified function a given… Read More »How to perform Function Iteration in Golang

How to Sum the Average for NBA Players in Golang

The challenge Write a function, called sumPPG, that takes two NBA player objects/struct/Hash/Dict/Class and sums their PPG Examples: The solution in Golang Option 1: Option 2:… Read More »How to Sum the Average for NBA Players in Golang

How to Compute a Cube as Sums in Golang

The challenge You will be given a number n (where n >= 1) and your task is to find n consecutive odd numbers whose sum is exactly the cube of n.… Read More »How to Compute a Cube as Sums in Golang

How to create a Coordinates Validator in Golang

The challenge You need to create a function that will validate if given parameters are valid geographical coordinates. Valid coordinates look like the following: “23.32353342, -32.543534534”.… Read More »How to create a Coordinates Validator in Golang

How to Validate ISBN-10 numbers in Golang

The challenge ISBN-10 identifiers are ten digits long. The first nine characters are digits 0-9. The last digit can be 0-9 or X, to indicate a value of 10.… Read More »How to Validate ISBN-10 numbers in Golang

Maximum Positive Integer Rotations in Golang

The challenge Write function MaxRot(n) which given a positive integer n returns the maximum number you got doing rotations similar to the above example. So MaxRot is such as: MaxRot(56789) should… Read More »Maximum Positive Integer Rotations in Golang

How to Find the Sum of Angles in Golang

The challenge Find the total sum of internal angles (in degrees) in an n-sided simple polygon. N will be greater than 2. The solution in… Read More »How to Find the Sum of Angles in Golang

How to Stop a Goroutine in Golang

It’s possible to stop a Goroutine by sending a value into it via a signal channel: As an alternative, you could also use a WaitGroup… Read More »How to Stop a Goroutine in Golang

Highest Rank Number in an Array in Golang

The challenge Complete the method which returns the number which is most frequent in the given input array. If there is a tie for the… Read More »Highest Rank Number in an Array in Golang

How to Reverse Sort Integers in Go

The challenge The two oldest ages function/method needs to be completed. It should take an array of numbers as its argument and return the two highest… Read More »How to Reverse Sort Integers in Go

How to check if a string is empty in Go

If you need to check if a string is empty in Go, then there are two possible ways to immediately verify this: Option 1 –… Read More »How to check if a string is empty in Go

How to read a file line by line in Go

If you need to read a file line by line in Go, then you can use the bufio package as follows: Just note that the… Read More »How to read a file line by line in Go