two algorithms on leetcode updated