Problems groups
August 2, 2023 ยท View on GitHub
This section contains subset of challenges that are grouped by type of solution (recursive, double pointer etc.) or type of problem (searching, sorting etc.). One challenge may fit int outfile groups.
Recursion
List of problems that can be solved using recursion.
- Count down
- Get odd
- Any callback
- Power
- Binary search tree (validate)
- Fibonacci
- Fibonacci with recursive cache
- Add up to
- Is substring
- Capitalize first
- Merge sort
- Quick sort
- Tree traversal (depth first)
Recursion with helper function
Recurrent helper function is useful when we want to solve problem in recursive way, but we don't want to change client
API by changing method signature of the original method eg. we don't want to add new parameters (additional data required
for recursive call) or change return type (eg. change List<Int> to MutableList<Int>).
Double pointer
Problem solved by using double variable pointing to various indexes of the list. We use double pointer instead of nested
loops which decreases complexity from O(n^2) to O(n).
- Sum zero
- Pair average
- Is substring
- Get duplicated arguments
- Midpoint
- Circular check
- Medan of sorted lists
Frequency counter
Problems solved by counting occurrence of element. We use frequency counter instead of nested loops which decreases
complexity from O(n^2) to O(n).
- Count unique values
- Is anagram
- Square equals
- Digit frequency
- Max occurring char
- Get duplicated arguments
- Subtract
- Has repeated char
Sliding window
We use sliding window instead of nested loops which decreases complexity from O(n^2) to O(n).
List
Search algorithms
Sort algorithms
Other list challenges
- Capitalize First
- Flatten
- Chunk
- Max sub-list sum
- Min sub-list length
- Find the pair with average
- Product
- Square compare
- List subtract
- Sum zero
- Coins
- Smallest elements
- Largest elements
- Reverse list
Singly Linked List
Doubly Linked List
Binary tree
Integer
- Add up to
- Count down
- Count up and down
- Digit frequency
- Factorial
- Fibonacci
- FizzBuzz
- Recursive cache fibonacci
- Generate all pairs
- Get odd numbers
- Power
- Print numbers
- Print numbers with steps
- Pyramid generator
- Reverse Int
- Steps generator
String
- Caesar cipher
- Capitalize sentence
- Decapitalize const
- Get duplicated arguments
- Has repeated char
- Is anagram
- Is palindrome
- Is tolerant palindrome
- Is permutation palindrome
- Is substring
- Longest word
- Max occurring char
- Reverse string
- Surrounded letter
- Find the vowels
- Format train route