Bit Manipulation
- List of problems with solutions
Question: Common bit tasks
Question: Complement of Base 10 Integer
Question: Power of two: Given an integer, write a function to determine if it is a power of two
Numbers / Math
Question: test
Question: Write a power function
Question: Swap: 2 variables
String Manipulation
Question: test case
Question: Write a function that reverses a string: approach swap, recursion, two pointers
Question: define anagrams
Question: making anagrams
Different tasks related to String Manipulation
Question: Alternating characters
Question: Sherlock valid string
Question: Number Jewels in stones
Question: First Unique Character in a String
Question: Find all anagrams in a String: approach sliding window and 2 counter Hashes
Array
Question:
Question: Remove duplicates from sorted array: approach 2 pointers, slow and fast runner
Question: Clone arrays
Question: Jump on clouds
Question: merge two sorted arrays (mergeSort algorithm)
Question: Single element in sorted array: approach brute force, binary search, BS only on even indexes
Question: Majority elements: using hash, sort, Voting Moore algorithm
Question: Find judge in the town, approach with one and two arrays
Question: Max contiguous subarray sum: brute force cubic and quadratic time
Linked Lists
Singly-linked List
Question: Singly linked list implementation
Stack
Question: Stack via Array
Question: Stack via Linked List
Question: Stack via String
Question: Stack via Object
Different problems related to Stacks
Question: Min Stack: approach 2 Stacks, approach minimum pairs
Question: Max Stack: approach 2 Stacks
Queue
Question: Queue via array
Question: Queue via linked list (1 pointer and 2 pointers)
Different problems related to Queues
Question:
Hash / Hash Table
Question: HashMap / HashTable implementation: use array
Question: HashSet implementation: use object
Question: Two sum using hash
Question:
Graph
Question: test
Question: Flood fill image bitmap algorithm using dfs (Depth-First Search)
Trees
Question:
Question: BT implementation: .insert(node)
Question: Binary Search Tree: .insert, .contains, height, lowest common ancestor
Question: Level order (bottom level) traversal BT
Question: Preorder traversal BT
Question: Invert Binary Tree: approach recursion
Heap
Question: test
Question: Max Binary Heap
Trees
Question: Trie implementation
Question:
Question: Trie design
Sorting
Question: Bubble sort: bubble up the biggest element to the right most position
Question: Selection sort: move the smallest element to the very left position
Question: Insertion sort: compare items on its left and shift if needed
Question: Merge sort
Question: Quick sort: pick a pivot
Question: Heapsort
Question: Find a median
Search / Binary search
- test
Question: Linear search: find an index of element in array
Question: Binary search with loop while and recursion
Different tasks related to Binary search
Question: Balanced sum
Question: First Bad version
Question:
Recursion
Question: Recursion examples
Question: Factorial using recursion
Question: Fibonacci Number: approach recursion, iterative solution
Question:
Greedy Algorithms
Question:
Question: Two city Scheduling
Question: Minimum absolute difference in an array
Question: Luck Balance
Dynamic Programming
Question:
Question: Coin change 2: DP and use as outer loop coins array
Question: Unique Binary Search Trees
Code Sandbox
Eloquent JavaScript
Question: Looping triangle
Question: fizzbuzz
Create a for loop that iterates up to 100 while outputting "fizz" at multiples of 3, "buzz" at multiples of 5 and "fizzbuzz" at multiples of 3 and 5
Question: Chessboard
Write a program that creates a string that represents an 8×8 grid, using newline characters to separate lines. At each position of the grid there is either a space or a "#" character. The characters should form a chessboard.
Question: Define whether a positive whole number is even or odd (using recursion): Zero is even, One is odd, for any other number N, its evenness is the same as N - 2.
Question: Reverse an array