codeeval solution using javascript
Question 1. Sudoku is a number-based logic puzzle. It typically comprises of a 99 grid with digits so that each column, each row and each of the nine 33 sub-grids that compose the grid contains all the digits from 1 to 9. For this challenge, you will be given an NN grid populated with numbers from 1 through N and you have to determine if it is a valid sudoku solution. You may assume that N will be either 4 or 9. The grid can be divided into square regions of equal size, where the size of a region is equal to the square root of a side of the entire grid. Thus for a 99 grid there would be 9 regions of size 3*3 each.
INPUT SAMPLE:
Your program should accept as its first argument a path to a filename. Each line in this file contains the value of N, a semicolon and the sqaure matrix of integers in row major form, comma delimited. E.g.
4;1,4,2,3,2,3,1,4,4,2,3,1,3,1,4,2 4;2,1,3,2,3,2,1,4,1,4,2,3,2,3,4,1
OUTPUT SAMPLE:
Print out True/False if the grid is a valid sudoku layout. E.g. True False Question 2. You've decided to make a road trip across the country in a straight line. You have chosen the direction you'd like to travel and made a list of cities in that direction that have gas stations to stop at and fill up your tank. To make sure that this route is viable, you need to know the distances between the adjacent cities in order to be able to travel this distance on a single tank of gasoline, (No one likes running out of gas.) but you only know distances to each city from your starting point. The first argument is a path to a filename. Each line in the file contains the list of cities and distances to them, comma delimited, from the starting point of your trip. You start your trip at point 0. The cities with their distances are separated by semicolon. E.g. Rkbs,5453; Wdqiz,1245; Rwds,3890; Ujma,5589; Tbzmo,1303; Vgdfz,70; Mgknxpi,3958; Nsptghk,2626; Wuzp,2559; Jcdwi,3761; Yvnzjwk,5363; Pkabj,5999; Xznvb,3584; Jfksvx,1240; Inwm,5720; Ramytdb,2683; Voclqmb,5236;
OUTPUT SAMPLE:
Print out the distance from the starting point to the nearest city, and the distances between two nearest cities separated by comma, in order they appear on the route. E.g.
1245,58,2587,1563,136 70,2489,67,1135,197 1240,2344,1779,357,279 2683,2553