Overview The objective is to reverse a number that is an integer. Integer can be negative as well. Some examples Here is the strategy First, make the input number positive Use the…
Tag: golang
Medium of two sorted arrays in Go (Golang)
Overview The objective is to return the medium of two sorted arrays. For example, if the input is Then the median is 4 because if we sort both arrays then 4 is…
Add two numbers represented by linked list in Go (Golang)
Overview Assume that both the linked list is already reversed. Meaning that let’s say the numbers are 478 339 The output should be 817 Assume both numbers are represented as a linked…
Find two numbers in an array that adds up to a target number in Go (Golang)
Overview For example, let’s say we have a given array The target number is 4 Then the answer will be index as we have Number 1 at index 2 Number 3 at…
Print/Output text in underline in Go (Golang)
Overview We can use the faith package to achieve the same https://github.com/fatih/color Program Output Note: Check out our Golang Advanced Tutorial. The tutorials in this series are elaborative and we have tried…
Print/Output crossed-out text in Go (Golang)
Overview We can use the faith package to achieve the same https://github.com/fatih/color Program Output Note: Check out our Golang Advanced Tutorial. The tutorials in this series are elaborative and we have tried…
Print/Output text with a background in Go (Golang)
Overview We can use the faith package to achieve the same https://github.com/fatih/color Program In the below program we are printing a text in white with red background Output Other background color options…
Print/Output text in italic in Go (Golang)
Overview We can use the faith package to achieve the same https://github.com/fatih/color Program Output
Load a .env or environment file in Go (Golang)
Overview gotenv package in golang can be used to load .env or environment file in golanghttps://github.com/joho/godotenv Below is the signature of the function It takes a variable number of arguments where each…
Print/Output text in bold in Go (Golang)
Overview We can use the faith package to achieve the same https://github.com/fatih/color Program Output