Algorithm Examples
Echo ports of common coding problems. Sources: examples/.
Array & list
- Add Two Numbers — two numbers as linked lists
- Container With Most Water — max area between lines
- Remove Duplicates from Sorted Array — in-place dedupe
- Remove Element — remove all of a value in place
- Merge Two Sorted Lists
- Merge K Sorted Lists
- Jump Game II — min jumps to last index
- Remove Nth Node From End of List
Search & sort
- Search Insert Position
- Search in Rotated Sorted Array
- First Missing Positive
- Find First Occurrence — substring
- Find First and Last Position
- Next Permutation
- Permutations
- Permutations II — unique perms
Strings
- Longest Palindromic Substring
- Longest Substring Without Repeating Characters
- Longest Valid Parentheses
- Longest Common Prefix
- Letter Combinations of Phone Number
- Substring with Concatenation of All Words
- String to Integer (atoi)
- Reverse Integer
- Palindrome Number
- Regular Expression Matching —
.and* - Wildcard Matching
- Valid Parentheses
- Group Anagrams
- Multiply Strings
- Zigzag Conversion
Math
- Integer to Roman
- Roman to Integer
- Divide Two Integers — no
/operator - Power of x, n
- Two Sum
- Three Sum
- Three Sum Closest
- Four Sum
- Trapping Rain Water
- Median of Two Sorted Arrays
Matrix & grid
Linked list
Misc
Run locally
bash
elang examples/two_sum.echo