Overview Let’s say the input is Then the answer would be We can use a hash for the solution. It is based upon the idea that If two of the numbers are…
Author: admin
Find all triplets in an array that adds to a zero in Go (Golang)
Overview Let’s say the input is Then the answer would be We can use a hash for the solution. It is based upon the idea that If two of the numbers are…
Check if a number is a palindrome or not in Go (Golang)
Overview For eg below numbers are palindrome Below numbers are not We have two solutions to find out if a number is palindrome or not Reverse the number. If the reversed number…
Implement your own Atoi function in Go (Golang)
Overview Atoi function converts a given string into its number representation. For eg Program Below is the program for the same. Output
Reverse a number or an integer in Go (Golang)
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…
Longest Palindromic Substring within a string in Go (Golang)
Overview The objective is to find the largest palindromic substring within a string. For eg let’s say the input string is The output should be aba which is the largest palindromic substring….
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…
Longest substring without repeating characters program in Go (Golang)
Overview A string is given and we have to find the longest substring in it without repeating characters. For eg if the string is Then the answer would be “abcd” and the…
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…