Блог пользователя salt_n_ice

Автор salt_n_ice, история, 4 года назад, По-английски

Problem Link

Here is my implementation: * Here, sn and en stands for starting node and ending node respectively, and mini_map is the 2d array showing path of shortest distance from starting node to all other reachable nodes. Rest is Breadth-First Search.

I don't see whats making this solution so long

Code
  • Проголосовать: нравится
  • -18
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Whenever ask doubt about a problem:

  1. Place your code in spoiler
  2. Insert link to the problem in blog

res = x+res;

this statement works in linear time( every time you insert a new character in front of string all characters of string are shifted one step right)

so insert at back and then reverse the string at the end