Inspired by the Geeksforgeeks - Top 10 Algorithms in Interview Questions article, the intent of this repository is to solve these questions using the Go Language. GO is a great language choice for technical interviews and hopefully here you can find the solutions to the common algorithms/problems easy to understand.
WIP, the description of the below unsolved yet
problems can be found in the orginal article.
Contributions are welcomed, following below guidelines
- keep the consistency and document the code
- keep it simple, easy to read and understand (not over-engineered, best performance is not in scope)
- Breadth First Search (BFS)
- Depth First Search (DFS)
- Shortest Path from source to all vertices (Dijkstra)
- [] Shortest Path from every vertex to every other vertex (Floyd Warshall)
- [] To detect cycle in a Graph (Union Find)
- [] Minimum Spanning tree (Prim)
- [] Minimum Spanning tree (Kruskal)
- [] Topological Sort
- [] Boggle (Find all possible words in a board of characters)
- [] Bridges in a Graph
- Insertion of a node in Linked List (On the basis of some constraints)
- [] Delete a given node in Linked List (under given constraints)
- [] Compare two strings represented as linked lists
- [] Add Two Numbers Represented By Linked Lists
- [] Merge A Linked List Into Another Linked List At Alternate Positions
- Reverse A List In Groups Of Given Size
- [] Union And Intersection Of 2 Linked Lists
- Detect And Remove Loop In A Linked List
- [] Merge Sort For Linked Lists
- [] Select A Random Node from A Singly Linked List
- Longest Common Subsequence
- [] Longest Increasing Subsequence
- [] Edit Distance
- [] Minimum Partition
- Ways to Cover a Distance
- [] Longest Path In Matrix
- Subset Sum Problem
- [] Optimal Strategy for a Game
- [] 0-1 Knapsack Problem
- [] Boolean Parenthesization Problem
- [] Binary Search
- [] Search an element in a sorted and rotated array
- Bubble Sort
- Insertion Sort
- Merge Sort
- Heap Sort (Binary Heap)
- Quick Sort
- [] Interpolation Search
- [] Find Kth Smallest/Largest Element In Unsorted Array
- [] Given a sorted array and a number x, find the pair in array whose sum is closest to x
- Find Minimum Depth of a Binary Tree
- [] Maximum Path Sum in a Binary Tree
- [] Check if a given array can represent Preorder Traversal of Binary Search Tree
- [] Check whether a binary tree is a full binary tree or not
- [] Bottom View Binary Tree
- [] Print Nodes in Top View of Binary Tree
- [] Remove nodes on root to leaf paths of length < K
- [] Lowest Common Ancest 633C or in a Binary Search Tree
- [] Check if a binary tree is subtree of another binary tree
- [] Reverse alternate levels of a perfect binary tree
- [] Modular Exponentiation
- [] Modular multiplicative inverse
- [] Primality Test | Set 2 (Fermat Method)
- [] Euler’s Totient Function
- [] Sieve of Eratosthenes
- [] Convex Hull
- [] Basic and Extended Euclidean algorithms
- [] Segmented Sieve
- [] Chinese remainder theorem
- [] Lucas Theorem
- [] Maximum Subarray XOR
- [] Magic Number
- [] Sum of bit differences among all pairs
- [] Swap All Odds And Even Bits
- [] Find the element that appears once
- [] Binary representation of a given number
- [] Count total set bits in all numbers from 1 to n
- [] Rotate bits of a number
- [] Count number of bits to be flipped to convert A to B
- [] Find Next Sparse Number
- [] Reverse an array without affecting special characters
- [] All Possible Palindromic Partitions
- [] Count triplets with sum smaller than a given value
- [] Convert array into Zig-Zag fashion
- [] Generate all possible sorted arrays from alternate elements of two given sorted arrays
- [] Pythagorean Triplet in an array
- [] Length of the largest subarray with contiguous elements
- [] Find the smallest positive integer value that cannot be represented as sum of any subset of a given array
- [] Smallest subarray with sum greater than a given value
- [] Stock Buy Sell to Maximize Profit