Overview A simple regex can be used to check if a string contains single or multiple white spaces in Go. Here is the program for the same Program Output Note: Check out…
Tag: go
Sort a slice of Int in Ascending and Descending order in Go (Golang)
Sort a slice in Ascending order sort.Ints package of going can be used to sort a full slice or a part of the slice. It is going to sort the string into…
Repeat a string multiple times in Go (Golang)
Overview strings.Repeat method can be used to repeat a string multiple times in Go (Golang) Here is the link to this function in the Go strings package https://pkg.go.dev/strings#Repeat Here is the signature…
Print the next or previous character given a char in Go (Golang)
Overview Simply by doing plus 1 and minus 1 we can get the next and previous character given a current char. Program Here is the program for the same Output: Note: Check…
Program for Longest Word in Dictionary through Deleting in Go (Golang)
Overview A string and a dictionary of words are given. The objective is to find the longest word in the dictionary which is present as a subsequence in the given string. If the…
Remove Linked List Elements Program in Go (Golang)
Overview Given a linked list and a value, delete all nodes from the linked list whose value is equal to the given value. Example 1 Example 2 Program Below is the program…
Count unguarded cells program in Go (Golang)
Overview Two integers m and n are given which represent an m*n grid. Other than that two 2D integer arrays are also given guards where guards[i] = [rowi , columni]. It represents…
Recover Binary Search Tree Program in Go (Golang)
Overview The root of a binary search tree is given. Two nodes of the binary search tree have been swapped. We need to fix the binary tree and recover the original structure…
Program for ugly number 2 in Go (Golang)
Overview An ugly number is a number whose prime factors are limited to 2,3 and 5. We have already seen a program where given a number n returns true if it is…
Is Graph Bipartite Program in Go (Golang)
Overview An undirected graph is given. A graph is said to be bipartite if the nodes of the graph can be partitioned into two subsets such that every edge connects one node…