Roadmap › 0. Fundamentals › Step 3
{}
Coding Round Practice (DSA in C#)
Big-O, arrays, strings, hashing, two pointers, sliding window, stacks, linked lists, trees, sorting, searching, recursion and the most-asked C# coding programs with solutions.
What it is & where it is used
Most .NET interviews include a coding round: 1–3 problems in 30–60 minutes, on a shared editor (CoderPad, HackerRank, Codility), on a whiteboard, or in Visual Studio over a screen share. Service companies ask classic programs (reverse a string, palindrome, Fibonacci, duplicates). Product companies ask LeetCode-style easy/medium problems (two sum, sliding window, trees).
What interviewers score:
- Clarifying the problem and edge cases before coding.
- A working brute-force idea, then an optimised one.
- Clean, compiling code with good names.
- Testing with examples and edge cases out loud.
- Stating time and space complexity.
Versions & history
Algorithms don't have versions, but the C# features you can use in a coding round do:
| Feature | Since | Useful for |
|---|---|---|
Generic collections List<T>, Dictionary<K,V> | C# 2.0 | Everything |
| LINQ | C# 3.0 | Quick grouping/sorting |
HashSet<T> | .NET 3.5 | Uniqueness / O(1) lookup |
Tuples + swap (a, b) = (b, a) | C# 7 | Two pointers |
Ranges/indices s[^1], s[1..3] | C# 8 | Slicing |
PriorityQueue<TElement,TPriority> | .NET 6 | Top-K, Dijkstra |
Collection expressions [1, 2, 3] | C# 12 | Test data |
CountBy, AggregateBy, Index() LINQ | .NET 9 | Frequency counting |
Lifecycle
How to solve a problem in an interview (UMPIRE):
- Understand — restate the problem; ask about input size, nulls, duplicates, negative numbers, sorted or not.
- Match — which pattern? (hash map, two pointers, sliding window, stack, BFS/DFS, binary search, DP)
- Plan — say the brute force and its complexity, then the better approach.
- Implement — write clean code; talk while typing.
- Review — dry-run with a small example; check edge cases (empty, one element, all same).
- Evaluate — state time/space complexity and possible improvements.
Tools used to develop
- Visual Studio / VS Code / Rider with
dotnet new consolefor practice. - LINQPad, dotnetfiddle.net, SharpLab — quick online/offline runners.
- LeetCode, HackerRank, Codility, CodeSignal, GeeksforGeeks — practice platforms (HackerRank/Codility are often used by Indian service companies for online tests).
- NeetCode 150 / Blind 75 — curated problem lists by pattern.
- BenchmarkDotNet — compare approaches.
- xUnit — write tests for your own solutions.