Is a prime number 2016-07-10 algorithm Write a function to return boolean for checking if it is a prime number. Read More
Reorder an array with given indexes 2016-07-09 algorithm We have an array of objects A and an array of indexes B. Reorder objects in array A with given indexes in array B. Do not change array A’s length.example:var A = [C, D, E, F, G];var B = [3, 0, 4, 1, 2];sort(A, B);// A is now [D, F, G, C, E]; Read More
Pascal's triangle 2016-07-07 algorithm Write a function to return the nth row in Pascal’s triangleFor example,getRow(1) returns 1getRow(2) returns 1 1getRow(3) returns 1 2 1getRow(4) returns 1 3 3 1 Read More