A comprehensive collection of Go code examples and exercises to improve coding skills for backend software engineering interviews.
This repository focuses on core Go programming concepts, data structures, algorithms, and testing practices. Each example includes detailed explanations and follows Go idioms.
-
Week 1: Go Language Fundamentals
- Day 1-2: Syntax, types, control flow
- Day 3-4: Structs, interfaces, pointers
- Day 5-7: Error handling, practice exercises
-
Week 2: Data Structures & Algorithms
- Day 1-2: Sorting, searching, recursion
- Day 3-4: Linked lists, trees basics
- Day 5-7: Algorithm implementation practice
-
Week 3: Concurrency & Testing
- Day 1-2: Goroutines, channels, patterns
- Day 3-4: Unit testing, benchmarks
- Day 5-7: Testing practice, concurrent programming
-
Week 4: Interview Problems & Advanced
- Day 1-2: Two pointers, sliding window
- Day 3-4: Context, common interview problems
- Day 5-7: Code review, optimization practice
Each example directory contains:
main.go- The main code exampleREADME.md- Detailed explanation of conceptspractice_problems.md- Additional practice problems with solutions- Test files (where applicable)
- 01-syntax-basics - Variables, types, operators, control flow
- 02-functions-methods - Functions, receivers, defer, panic/recover
- 03-slices-maps - Arrays, slices, maps, sorting
- 04-structs-interfaces - Structs, methods, interfaces, embedding
- 05-pointers-memory - Pointers, memory management, value vs reference
- 06-error-handling - Go's error handling patterns
- 07-sorting-searching - Built-in sort, binary search, custom comparers
- 08-recursion-dp - Recursion, memoization, basic DP problems
- 09-goroutines-basics - Goroutines, basic channels, select
- 10-concurrency-patterns - Worker pools, fan-in/fan-out, pipelines
- 11-sync-primitives - Mutex, RWMutex, WaitGroup, Once
- 12-unit-testing - Basic tests, table-driven tests, subtests
- 13-benchmarks - Performance testing, profiling basics
- 14-two-pointers - Two pointers, sliding window problems
- 15-linked-lists - Singly/doubly linked lists, common operations
- 16-trees-graphs - Binary trees, traversal, basic graph algorithms
- 17-context-timeout - Context usage, cancellation, timeouts
- 18-common-interview - LeetCode-style problems in Go
- Go 1.19 or later
- Basic programming knowledge
- Familiarity with command line
- Clone this repository
- Navigate to any example directory
- Run
go run main.goto execute the example - Read the README.md for detailed explanations
- Run tests with
go test(where available)
- Idiomatic Go: Following Go conventions and best practices
- Performance: Understanding time/space complexity
- Testing: Comprehensive test coverage and benchmarking
- Error Handling: Proper Go error handling patterns
- Concurrency: Safe concurrent programming patterns
Start with 01-syntax-basics and work through the examples in order. Each example builds on the previous ones.