简单写了一下第一题解析:
https://www.nowcoder.com/discuss/218193