Single character drift
A configuration auditor renders the same service setting on two hosts and compares the two lines it gets back. Operators want to know whether one mistyped character explains the drift, which is cheap to fix, or whether the hosts are genuinely running different settings. Given baseline and rendered, return the zero based index of the single position where the two lines hold different characters, but only when the lines are the same length and disagree at exactly one position. Return -1 in every other case. Identical lines count as zero differences, so they are not a single character drift. Two or more disagreements are not one either. Lines of different lengths are never comparable this way. The comparison is case sensitive.
single_char_drift_index(baseline: str, rendered: str) → int["timeout=30","timeout=90"]out8["retries=3","retries=3"]out-1["region=us-east-1","region=us-west-1"]out-1State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
["timeout=30","timeout=90"]8not run yetsample["retries=3","retries=3"]-1not run yetsample["region=us-east-1","region=us-west-1"]-1not run yetsample