ByteDance interview question

1. Why hashmap can perform O(1)? 2. Two leetcode medium problems.