A curated collection of efficient, well-documented solutions to TestDome coding challenges in C#
TestDome provides real-world coding assessments used by companies for technical screening. This repository demonstrates:
- Clean, readable solutions that prioritize clarity and maintainability
- Optimal time complexity implementations using appropriate data structures
- Production-ready code with proper error handling and edge case coverage
- Learning-focused comments explaining problem constraints and approach
| Problem | Difficulty | Topics | Time Complexity |
|---|---|---|---|
| Binary Search Tree | ⭐⭐ | Trees, Recursion | O(log n) |
| Two Sum | ⭐⭐ | Hash Tables, Arrays | O(n) |
| Sorted Search | ⭐⭐ | Binary Search | O(log n) |
| Train Composition | ⭐⭐ | Stacks, Deque | O(1) operations |
| Frog | ⭐⭐ | Dynamic Programming | O(n) |
| Problem | Difficulty | Topics | Time Complexity |
|---|---|---|---|
| Palindrome | ⭐ | String Processing | O(n) |
| Are Anagrams | ⭐⭐ | String, Hash Maps | O(n) |
| All Anagrams | ⭐⭐⭐ | String, Grouping | O(n * k log k) |
| Problem | Difficulty | Topics | Time Complexity |
|---|---|---|---|
| Merge Names | ⭐ | LINQ, Sets | O(n) |
| Common Names | ⭐ | LINQ, Intersection | O(n + m) |
| Song | ⭐⭐ | Linked Lists | O(n) |
| Problem | Difficulty | Topics | Time Complexity |
|---|---|---|---|
| Account | ⭐⭐ | OOP, Encapsulation | - |
| Folder | ⭐⭐ | Composite Pattern | O(n) |
| Path | ⭐⭐ | String Parsing | O(n) |
| Route Planner | ⭐⭐⭐ | Graph Traversal, BFS | O(V + E) |
- .NET SDK 6.0 or higher
- Any C# IDE (Visual Studio, Rider, VS Code)
Each file is self-contained with a Main method for easy testing:
# Navigate to the C# Questions directory
cd "C# Questions"
# Compile and run any solution
dotnet run BST.cs
# Or use the C# compiler directly
csc BST.cs && ./BST.exeProblem: Find two indices whose values sum to a target.
public static Tuple<int, int> FindTwoSum(IList<int> list, int sum)
{
Dictionary<int,int> map = new Dictionary<int, int>();
for (int i = 0; i < list.Count; i++)
{
int target = sum - list[i];
if (map.ContainsKey(target))
return new Tuple<int, int>(i, map[target]);
map[list[i]] = i;
}
return null;
}Key Insight: Single-pass solution using hash table to store complements. Time: O(n), Space: O(n).
Problem: Efficiently check if a BST contains a value.
public static bool Contains(Node root, int value)
{
if (root == null) return false;
if (root.Value == value)
return true;
else if (root.Value < value)
return Contains(root.Right, value);
else if (root.Value > value)
return Contains(root.Left, value);
else
return false;
}Key Insight: Exploits BST ordering property to achieve O(log n) average case vs O(n) for unordered tree traversal.
Beginner (Start here if new to algorithms)
- Palindrome
- Merge Names
- Common Names
Intermediate (Build on fundamentals) 4. Two Sum 5. Binary Search Tree 6. Are Anagrams 7. Sorted Search
Advanced (Graph algorithms & optimization) 8. Route Planner 9. All Anagrams 10. Frog (Dynamic Programming)
- Average Time Complexity: O(n) or better for 87% of solutions
- Space Optimization: In-place algorithms used where possible
- Code Quality: All solutions tested against TestDome's test suites
- Documentation: Every solution includes problem description and constraints
TESTDOME-Questions/
├── C# Questions/ # All C# solution files
│ ├── BST.cs # Self-contained with problem statement
│ ├── TwoSum.cs # Each file has Main method for testing
│ └── ...
└── README.md # This file
- TestDome Platform: https://www.testdome.com/questions
- C# Documentation: Microsoft Docs
- Algorithm Complexity Reference: Big-O Cheat Sheet
Found a more efficient solution or want to add problems in other languages? Contributions are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/python-solutions) - Include problem description as comments
- Add test cases in
Mainmethod - Submit a pull request
This project is licensed under the MIT License - see individual files for problem copyrights held by TestDome.
These solutions are provided for educational purposes. If you're taking a TestDome assessment:
- Understand the logic, don't copy blindly
- Companies value problem-solving process over memorized solutions
- Use this as a learning resource to improve your skills
Happy Coding! 🚀
Built with ☕ and algorithms