Overview Given an image represented in the form of a matrix, rotate this matrix or image in a clockwise direction. For eg Input: Output: Idea is to iterate over all the borders…
Author: admin
Trapping rainwater problem in Go (Golang)
Overview There is a set of bars each of 1 unit width but different heights placed alongside. The height of the bars is represented using an array The array represents that The…
Wildcard matching or regex matching program in Go (Golang)
Overview We are given an input regex and an input string. Regex can have two special characters Star Sign ‘*’ – the star matches zero or more characters. Question Mark ‘?’ –…
Find the first and last position of a target element in a sorted array in Go (Golang)
Overview The objective is to find the first and last position of an element in a sorted array. Eg Strategy is to Do a binary search in the array and find the…
Sort a string in Go (Golang)
Overview In Golang string is a sequence of bytes. A string literal actually represents a UTF-8 sequence of bytes. In UTF-8, ASCII characters are single-byte corresponding to the first 128 Unicode characters. All…
Search in a sorted and pivoted array in Go (Golang)
Overview We have an input array that is sorted but is pivoted at a certain index. For example, consider below array It has been rotated and pivoted at index 3 Given a…
Find the pivot index in a sorted and pivoted array in Go (Golang)
Overview We have an input array that is sorted but is pivoted at a certain index. For example, consider below array It has been rotated and pivoted at index 3 The objective…
Evaluation of Postfix Expression in Go (Golang)
Evaluation of Postfix Expression In this tutorial, we will evaluate a postfix expression. Algorithm: Scan postfix expression from left to right. If the current scanned character is an operand, push it in…
Infix to Postfix Conversion in Go (Golang)
Infix to Postfix Conversion In this tutorial, we will see what are the Infix and Postfix expression notations, the advantages of Postfix notation over Infix, and how we can convert an Infix…
Find first missing positive integer in an int array in Go (Golang)
Overview The objective is to find the first missing positive integer in an int array. Eg We can make the index of the array negative if the number equal to that index…