Scott McCartney's 01_Git_and_Intro

This will work, but it is actually even easier than that. If you push for each +1, and pop for each -1 ... then if you ever try to pop when the stack is empty, then it wasn't a Dyck word.