Introduction
Almost every coding problem you will meet in an exam or an interview is a variation of a small number of recurring problems solved by a small number of reusable patterns. If you memorize 200 separate problems you will forget them; if you understand ~12 core patterns, you can reconstruct the solution to almost anything on the spot. This lesson teaches the classic beginner-to-intermediate coding problems (FizzBuzz, palindrome, prime check, Fibonacci, GCD, sorting, searching, duplicates, anagrams) together with the general patterns behind them (brute force, two pointers, sliding window, hashing/frequency map, prefix sum, binary search, recursion/divide-and-conquer, greedy, dynamic programming, and graph/tree traversal).
For BCS, Bank IT, and IT-officer written and viva exams this topic is high-value: MCQs ask you to trace pseudocode, give the output, name the pattern, or state the time complexity. Getting the pattern right lets you answer even unseen questions.
Learning objectives
- Recognize the ~12 core algorithmic patterns and when each applies.
- Solve the classic problems: FizzBuzz, palindrome, factorial, Fibonacci, prime test, GCD, digit sum, reverse, max/min, duplicate detection, anagram check.
- Trace pseudocode by hand and predict its output.
- State the time and space complexity of each pattern using Big-O.
- Choose the most efficient known approach for a given constraint.
- Avoid the standard traps: off-by-one, integer overflow, wrong loop bounds, and mutating a collection while iterating.