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.
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)
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>
).
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
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
We use sliding window instead of nested loops which decreases complexity from O(n^2)
to O(n)
.
- 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
- 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