LightHouse1's blog

By LightHouse1, history, 7 months ago, In English

In C++,we can use std:map which prevents hash collision. What is the way out in python?

  • Vote: I like it
  • +6
  • Vote: I do not like it

»
3 days ago, # |
  Vote: I like it +8 Vote: I do not like it

A solution that I found was that instead of having the keys in your dictionary as integers make them as strings, that reduced the density of integers at a particular place, which was originally leading to TLE

»
3 days ago, # |
  Vote: I like it 0 Vote: I do not like it

https://codeforces.me/blog/entry/101817

use the wrapper class while accessing keys in a dictionary