Comparing with context
Read a diff from removed to added, keep unchanged lines around each change, and say what you expected.
A diff is a list of what changed between two versions. The lines without a mark are context — they tell you where you are.
function twoSum(nums, target) {
− return -1;
+ return [];
}Read removed lines first
Look at what was taken away before what was added. Most surprises come from something that quietly disappeared.
Tip: In Shareroom’s Text diff, every changed line carries a + or − marker as well as a colour, so you never compare by eye.