Documentation ¶
Index ¶
- func CheckPatternMatchesBruteForce(pattern, value string) bool
- func CheckPatternMatchesOptimized(pattern, value string) bool
- func ConvertNumberToString(num int) string
- func CountFactorialZeros(num int) int
- func DivideWithOnlyAddition(x, y int) int
- func FindSmallestNonNegativeDifference(array1, array2 []int) int
- func FindUnsortedSequence(array []int) (left, right int)
- func FlipSignWithAddition(num int) int
- func GetContiguousSequence(input []int) (sum int)
- func GetContiguousSequenceBruteForce(input []int) (sum int)
- func GetDivingBoardLengths(number, shorter, longer int) []int
- func GetDivingBoardLoop(number, shorter, longer int) []int
- func GetValidT9Words(number string, dictionary map[string]string) []string
- func GetWordFrequency(input string, word string) int
- func HasWonTicTacToe(board [3][3]int) int
- func LangtonsAnt(moves int) string
- func MaxAliveYear(people []person, min, _ int) int
- func MaxNumWithoutComparison(a, b int) int
- func MultiplyWithOnlyAddition(x, y int) int
- func PairsWithSum(array []int, sum int) (result [][]int)
- func PondSizesBruteForce(plotOfLand [][]int) (sizes []int)
- func PondSizesOptimized(land [][]int) (sizes []int)
- func Rand7() int
- func SubtractWithOnlyAddition(x, y int) int
- func SwapNumbersInPlace(a, b *int)
- func SwapNumbersInPlaceUsingBitOperations(a, b *int)
- type LRUCache
- type MatrixPoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPatternMatchesBruteForce ¶
CheckPatternMatchesBruteForce checks if value matches pattern
func CheckPatternMatchesOptimized ¶
CheckPatternMatchesOptimized checks if value matches pattern
func ConvertNumberToString ¶
ConvertNumberToString converts an integer into it's string counterpart
func CountFactorialZeros ¶
CountFactorialZeros counts the number of zeros in the factorial of num
func DivideWithOnlyAddition ¶
DivideWithOnlyAddition implements x/y
func FindSmallestNonNegativeDifference ¶
FindSmallestNonNegativeDifference returns the smallest non negative difference of any 2 elements in both arrays
func FindUnsortedSequence ¶
FindUnsortedSequence returns the start and left of a sequence of elements in an array such that if those elements are sorted, then the array will be sorted.
func FlipSignWithAddition ¶
FlipSignWithAddition flips the sign of a number using only addition.
func GetContiguousSequence ¶
GetContiguousSequence returns the sum of largest sequence of elements in an input array
func GetContiguousSequenceBruteForce ¶
GetContiguousSequenceBruteForce returns the sum of the largest sequence of increasing elements from an array by testing all elements
func GetDivingBoardLengths ¶
GetDivingBoardLengths gets the length that can be made up of 2 weights
func GetDivingBoardLoop ¶
GetDivingBoardLoop gets the length using 1 loop.
func GetValidT9Words ¶
GetValidT9Words returns words in dictionary having a t9 encoding
func GetWordFrequency ¶
GetWordFrequency returns how many time a string exists in an input
func HasWonTicTacToe ¶
HasWonTicTacToe checks if a tic tac toe board contains a winner
func LangtonsAnt ¶
LangtonsAnt performs a simulation of the langtons ant.
func MaxAliveYear ¶
MaxAliveYear gets the max year in which people are alive withing a certain range.
func MaxNumWithoutComparison ¶
MaxNumWithoutComparison gets the max of 2 numbers without comparing
func MultiplyWithOnlyAddition ¶
MultiplyWithOnlyAddition multiplies two numbers using only addition
func PairsWithSum ¶
PairsWithSum returns all pairs of numbers having a specific sum
func PondSizesBruteForce ¶
PondSizesBruteForce finds the length of all ponds in a matrix
func PondSizesOptimized ¶
PondSizesOptimized finds all ponds with a specified length
func SubtractWithOnlyAddition ¶
SubtractWithOnlyAddition implements x - y
func SwapNumbersInPlace ¶
func SwapNumbersInPlace(a, b *int)
SwapNumbersInPlace swaps 2 numbers without using any extra memory
func SwapNumbersInPlaceUsingBitOperations ¶
func SwapNumbersInPlaceUsingBitOperations(a, b *int)
SwapNumbersInPlaceUsingBitOperations swaps 2 numbers using XOR operations
Types ¶
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache is the data structure for an LRU cache
func (*LRUCache) SetKeyValue ¶
SetKeyValue sets the value into the front of the cache.
type MatrixPoint ¶
type MatrixPoint struct {
// contains filtered or unexported fields
}
MatrixPoint represents a point in a matrix
Source Files ¶
- 10_max_year_alive.go
- 11_diving_board.go
- 16_find_unsorted_sequence.go
- 17_contiguous_sequence.go
- 18_pattern_matching.go
- 19_pond_sizes.go
- 1_number_swapper.go
- 20_t9.go
- 22_langtons_ant.go
- 23_rand7_from_rand5.go
- 24_pairs_with_sum.go
- 25_lru_cache.go
- 26_calculator.go
- 2_word_frequencies.go
- 3_line_intersection.go
- 4_has_won_tic_tac_toe.go
- 5_factorial_zeros.go
- 6_smallest_difference.go
- 7_max_number.go
- 8_english_int.go
- 9_math_operations_with_add.go