Hackerrank – HourRank5 – Hr City

nice problem, have to be extra careful when writing the recurrence relations.

dist[n] denotes the sum of the distances between each pair of nodes in the nth step.

coun[n] denotes the number of nodes in the nth step.

cdis[n] denotes the distance from every node to the corner of the structure in the nth step

corn[n] denotes the distance between north east corner to south west corner of the structure in the step

https://gist.github.com/6687e9341af3f0aaf216

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s