azhar556's blog

By azhar556, history, 6 years ago, In English

Hi, I just solved my first dfs problem 1020B - Badge. Honestly i've never solve dfs before and i was thinking very long to understand this, this is very new for me. Summary, dfs in this problem is basically searching the one who visited twice and then break, and repeat several times depend the "n". This is my submission 45184407, in my submission i was trying to separate my dfs function to make easier to debug this and to make easier to read. One thing make me confused on this problem is the sequence is starting with one(1). Usually i starting with zero(0), but in this case its hard to implementing because the array input is based with one(1) too. Then to make easy i starting with one(1).

(newbie 996)

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Here is a code after converting to 0-based counting.