# Go

## Floating-point Approximation in Golang

The challenge Consider the function f: x -> sqrt(1 + x) – 1 at x = 1e-15. We get: f(x) = 4.44089209850062616e-16 This function involves the subtraction of… Read More »Floating-point Approximation in Golang

## All the Ways to Divide an Array in Two in Golang

The challenge Write a function partlist that gives all the ways to divide an array of at least two elements into two non-empty parts. Each two non… Read More »All the Ways to Divide an Array in Two in Golang

## How to check if a file exists in Go

If you need to check if a file exists using Go, then you can use one of the following methods, depending on the version of… Read More »How to check if a file exists in Go

## How to convert a string value to an int in Go

If you need to convert a string to an int in Go, then you should use the strconv.Atoi function: Learn how to convert an int… Read More »How to convert a string value to an int in Go

## How to convert an int value to string in Go

If you need to convert an int to a string in Go, then you should use the strconv.Itoa function: Learn how to convert a string… Read More »How to convert an int value to string in Go

## How to Efficiently Concatenate Strings in Go

If you are using a version of Go >= 1.10, then you should be using the newer strings.Builder pattern as follows: For older version, you… Read More »How to Efficiently Concatenate Strings in Go

## How to Loop Forever in Golang

If you need to loop forever, or infinitely, in your Go code, then you have 2 options: Option 1: Option 2: Just remember that you… Read More »How to Loop Forever in Golang

## Understanding For Loops in Golang

In Golang a for loop is a way to loop through an iterable. The most basic For Loop A classic For Loop For Loop without… Read More »Understanding For Loops in Golang

## How to Find the Smallest Integer in the Array in Golang

The challenge Given an array of integers your solution should find the smallest integer. For example: Given [34, 15, 88, 2] your solution will return 2 Given [34, -345,… Read More »How to Find the Smallest Integer in the Array in Golang

## Forming Unique Array Combinations in Golang

The challenge You are given an array of arrays and your task will be to return the number of unique arrays that can be formed… Read More »Forming Unique Array Combinations in Golang

## How to Sum all the Integers in a String in Golang

The challenge Implement a function that calculates the sum of the integers inside a string. For example, in the string “The30quick20brown10f0x1203jumps914ov3r1349the102l4zy dog”, the sum of the… Read More »How to Sum all the Integers in a String in Golang

## How to Reverse a String in Golang

The challenge Complete the solution so that it reverses the string passed into it. The solution in Golang Option 1: Option 2: Option 3: Test… Read More »How to Reverse a String in Golang

## How to Circularly Sort an Array in Golang

The challenge An array is circularly sorted if the elements are sorted in ascending order but displaced, or rotated, by any number of steps. Complete the function/method… Read More »How to Circularly Sort an Array in Golang

## How to Alternate String Casing in Golang

The challenge Write a function toWeirdCase (weirdcase in Ruby) that accepts a string, and returns the same string with all even indexed characters in each word uppercased, and… Read More »How to Alternate String Casing in Golang

## Roman Numerals Decoder in Golang

The challenge Create a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. You don’t need… Read More »Roman Numerals Decoder in Golang

## How to Subtract from Time in Golang

The challenge Clock shows h hours, m minutes and s seconds after midnight. Your task is to write a function that returns the time since midnight in milliseconds. Example: Input constraints:… Read More »How to Subtract from Time in Golang

## Bit Counting in Golang

The challenge Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary… Read More »Bit Counting in Golang

## How to Find the First Non-Repeating Character in Golang

The challenge Write a function named first_non_repeating_letter that takes a string input, and returns the first character that is not repeated anywhere in the string. For example,… Read More »How to Find the First Non-Repeating Character in Golang

## How to Find the Last Fibonacci Digit in Golang

The challenge Return the last digit of the nth element in the Fibonacci sequence (starting with 1,1, to be extra clear, not with 0,1 or… Read More »How to Find the Last Fibonacci Digit in Golang

## How to Validate an IP Address in Golang

The challenge Write an algorithm that will identify valid IPv4 addresses in dot-decimal format. IPs should be considered valid if they consist of four octets,… Read More »How to Validate an IP Address in Golang