I am gettign TLE for The Parking Slot problem on hackerearth, here is the link to my code, I have used dijkstra's algorithm. Help needed in getting AC for this problem. asked 26 Jun, 09:37

There was problem in your dijkstra code. You were always pushing into the queue. But you should do that only when needed. Just change this and you get AC. if(d[edge.v][DISTANCE]>d[u.v][DISTANCE] + edge.w){ d[edge.v][DISTANCE] = Long.min(d[edge.v][DISTANCE], d[u.v][DISTANCE] + edge.w); queue.add(new Edge(edge.v, d[edge.v][DISTANCE])); } answered 26 Jun, 11:24
