You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
A collection of coding interview challenges implemented in Zig. Each folder contains one or more solutions to a classic problem, often with multiple approaches in the same file (for example, naive vs optimized, hash map vs Boyer–Moore, or runtime vscomptime versions).
The goal of this project is to practice algorithms and data structures while learning how to write and structure real Zig programs. Many challenges are used to compare different techniques side by side.
19 - Hash: Group anagrams – grouping strings by signature
20 - Hash: LRU cache – cache with eviction policy
Majority / Voting Algorithms
16 - Boyer-Moore, Majority element problem – hash‑map solution and Boyer–Moore voting
Linked Lists
21 - LinkedList Apple linked list – Apple‑style linked list question
22 - Linkedlist: Amazon linked list cycle – cycle detection
23 - LinkedList: Microsoft reverse link list – reversing a list
24 - LinkedList: Adobe linked list add two numbers – addition via linked lists
25 - LinkedList: remove nth node from the end of the list – two‑pointer removal
26 - LinkedList: Odd even LinkedList – reordering by position
Trees
31 - Trees: Microsoft trees question symetric trees – symmetric tree check
32 - Trees: Google mas depth of binary tree – maximum depth of a binary tree
There are more problems planned; new folders will follow the same naming pattern.
How to Run a Challenge
From the repository root, change into the directory you want and use Zig’s build system. Each challenge has its ownbuild.zig, so you always run commands from inside the challenge folder:
cd"14 - Hash: two sum"# Build and run the examplezig build run# Run tests (when defined for that challenge)zig buildtest
This layout is repeated across all folders, so you can substitute any other challenge directory. When a file contains multiple solution variants, themain entry point usually selects one of them or runs a small comparison.
What You Can Learn Here
Core interview patterns
Two pointers
Sliding window
Binary search (including variants for first/last position)
Hash‑based counting and lookup
Zig concepts in practice
Using the standard library (std) effectively
Allocators (e.g.std.heap.ArenaAllocator) and manual memory management
comptime for compile‑time work
Error handling with! andtry
You can treat each folder as a small, focused Zig learning exercise.
Contributing / Extending
You can extend this repo by:
Adding new challenge folders following the existing naming scheme
Providing alternative solutions (e.g. different time/space trade‑offs)
Adding more tests inside existingmain.zig files or splitting code into small helper modules
No strict style rules are enforced, but keeping code small, clear, and idiomatic to Zig is preferred.
License
Unless specified otherwise, this project is intended as an open educational resource. If you plan to redistribute or use it in another project, consider adding an explicit license file that matches your needs (for example MIT or Apache‑2.0).