A collection of problem-solving functions in Go.
The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones. This function calculates the Fibonacci sequence up to a given number n and returns the sequence as an array or slice.
This function determines whether a given number n is prime or not. A prime number is a natural number greater than 1 that is divisible only by 1 and itself.
The palindrome check function determines whether a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forwards and backwards.
The reverse string function reverses a given string without using the built-in reverse function. It swaps the characters from the start and end of the string until the entire string is reversed.
The number sequence function generates various number sequences based on user input. It currently supports the following types of sequences:
- Fibonacci Sequence
- Prime Numbers
- Palindrome Numbers
- Square Numbers
- Cube Numbers
The factorial function calculates the factorial of a given number n. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n.
The find duplicates function finds and returns any duplicates in a given array or slice. It scans through the elements and identifies any values that occur more than once.
The binary search algorithm searches for a given target value in a sorted array. It repeatedly divides the search interval in half until the target value is found or the interval is empty.
The anagram check function checks whether two given strings are anagrams. Anagrams are words or phrases formed by rearranging the letters of another word or phrase.
The word count function counts the occurrence of each word in a given string and returns the word count as a map. It splits the string into words and counts their frequencies.
The matrix operations functions perform basic matrix operations such as matrix addition, multiplication, and transposition. These operations are useful in linear algebra and numerical computations.