rewrite leetcode subset