title: What is the time complexity of dict.keys() in Python?
body: <p>I came across a question when I solved <a href="https://leetcode.com/problems/insert-delete-getrandom-o1/" rel="noreferrer">this LeetCode problem</a>. Although my solution got accepted by the system, I still do not have any idea after searching online for the following question:</p>
  <p><code>What is the time complexity of dict.keys() operation?</code></p>
  <p>Does it return a view of the keys or a real list (stores in memory) of the keys?</p>