Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” Algorithm toolkit

โญ beginnerโณ 20 min read๐Ÿ“ Lesson 81 of 85

Three classic patterns in one solution: sum-formula gaps, single-use pair sums, and run-length encoding.

Checkpoint: the algorithm toolkit

Task: implement in Solution:

  1. static int MissingNumber(int[] nums) โ€” the array holds n distinct numbers from 0..n with exactly one missing; return it. ([3,0,1] โ†’ 2.)
  2. static bool HasPairSum(int[] nums, int target) โ€” true when two distinct elements sum to target (an element may not pair with itself).
  3. static string Compress(string s) โ€” run-length encoding: "aaabbc" โ†’ "a3b2c1"; every run's count is written, even 1 ("a" โ†’ "a1"); empty โ†’ empty.