Which time complexety this code have?
line = "..."
occuriences_cnt = {char: line.count(char) for char in line}
I'm assuming that this is 0(n^2)
, because there is count
- O(n) in loop. Am I wrong?
Which time complexety this code have?
line = "..."
occuriences_cnt = {char: line.count(char) for char in line}
I'm assuming that this is 0(n^2)
, because there is count
- O(n) in loop. Am I wrong?