Algorithm Examples
This section contains a collection of algorithm implementations in Echo, demonstrating how to solve various coding challenges. All source code is available in the repository's examples folder.
Array & List Manipulation
Learn how to work with arrays and lists through practical algorithm implementations.
- Add Two Numbers - Add two numbers represented as linked lists
- Container With Most Water - Find two lines that form a container with maximum area
- Remove Duplicates from Sorted Array - Remove duplicates in-place from sorted array
- Remove Element - Remove all instances of a value in-place
- Merge Two Sorted Lists - Merge two sorted linked lists
- Merge K Sorted Lists - Merge k sorted lists into one sorted list
- Jump Game II - Find minimum jumps to reach last index
- Remove Nth Node From End of List - Remove the nth node from end of list
Searching & Sorting
Algorithms for efficiently searching and sorting data.
- Search Insert Position - Find the index to insert target in sorted array
- Search in Rotated Sorted Array - Search in rotated sorted array
- First Missing Positive - Find first missing positive integer
- Find First Occurrence - Find first occurrence of substring
- Find First and Last Position - Find first and last position of target in sorted array
- Next Permutation - Generate next lexicographic permutation
- Permutations - Generate all permutations of a list
- Permutations II - Generate all unique permutations
String Manipulation
Work with strings and solve text processing challenges.
- Longest Palindromic Substring - Find longest palindromic substring
- Longest Substring Without Repeating Characters - Find longest substring without repeating chars
- Longest Valid Parentheses - Find length of longest valid parentheses
- Longest Common Prefix - Find longest common prefix of strings
- Letter Combinations of Phone Number - Generate letter combinations of phone number
- Substring with Concatenation of All Words - Find all substring concatenations
- String to Integer (atoi) - Convert string to integer
- Reverse Integer - Reverse digits of integer
- Palindrome Number - Check if number is palindrome
- Regular Expression Matching - Match string with pattern including '.' and '*'
- Wildcard Matching - Match string with wildcard pattern
- Valid Parentheses - Check if parentheses are valid
- Group Anagrams - Group anagrams together
- Multiply Strings - Multiply two numbers as strings
- Zigzag Conversion - Convert string to zigzag pattern
Math & Number Operations
Mathematical algorithms and number manipulations.
- Integer to Roman - Convert integer to Roman numeral
- Roman to Integer - Convert Roman numeral to integer
- Divide Two Integers - Divide two integers without using division operator
- Power of x, n - Calculate x to the power of n
- Two Sum - Find two numbers that add up to target
- Three Sum - Find all triplets that sum to zero
- Three Sum Closest - Find three sum closest to target
- Four Sum - Find all quadruplets that sum to target
- Trapping Rain Water - Calculate water trapped between elevations
- Median of Two Sorted Arrays - Find median of two sorted arrays
Matrix & Grid Problems
Solve problems involving matrices and grids.
- Rotate Image - Rotate image 90 degrees
- Valid Sudoku - Validate Sudoku board
- Solve Sudoku - Solve Sudoku using backtracking
Linked List Operations
Work with linked list data structures.
- Swap Nodes in Pairs - Swap adjacent nodes in linked list
- Reverse Nodes in K-Group - Reverse nodes of list k at a time
Miscellaneous
- Generate Parentheses - Generate all valid parentheses combinations
- Language Feature Smoke Test - Test various Echo language features
Getting Started with Examples
To run any of these examples locally:
bash
python echolang.bat path/to/example.echoOr clone the repository and run directly:
bash
git clone https://github.com/deekshith-poojary98/echo.git
cd echo
echo examples/two_sum.echoSee Also
- Hello World - Simple getting started example
- Mini Programs - Short practical programs
- Functions in Practice - Working with functions
- Lists in Practice - Working with lists
- Hash Usage - Working with hash maps
