## The Power Sum

Find the number of ways that a given integer, X , can be expressed as the sum of the Nth powers of unique, natural numbers. For example, if X = 13 and N = 2 , we have to find all combinations of unique squares adding up to 13. The only solution is 2^2 + 3^2. Function Description Complete the powerSum function in the editor below. It should return an integer that represents the number of possible combinations. powerSum has the following parameter(s): X: the integer to sum to N:

View Solution →## Crossword Puzzle

A 10 x 10 Crossword grid is provided to you, along with a set of words (or names of places) which need to be filled into the grid. Cells are marked either + or -. Cells marked with a - are to be filled with the word list. The following shows an example crossword from the input crossword grid and the list of words to fit, Function Description Complete the crosswordPuzzle function in the editor below. It should return an array of strings, each representing a row of the finished puzzl

View Solution →## Recursive Digit Sum

We define super digit of an integer x using the following rules: Given an integer, we need to find the super digit of the integer. If x has only 1 digit, then its super digit is x. Otherwise, the super digit of x is equal to the super digit of the sum of the digits of x. For example, the super digit of9875 will be calculated as: super_digit(9875) 9+8+7+5 = 29 super_digit(29) 2 + 9 = 11 super_digit(11) 1 + 1 = 2 super_digit(2) = 2 Function Description Co

View Solution →## Lena Sort

Lena developed a sorting algorithm described by the following pseudocode: lena_sort(array nums) { if (nums.size <= 1) { return nums; } pivot = nums[0]; array less; array more; for (i = 1; i < nums.size; ++i) { // Comparison if (nums[i] < pivot) { less.append(nums[i]); } else { more.append(nums[i]); } } sorted_less = lena_sort(less); sorted_more = lena_sort(more); ans

View Solution →## Flipping the Matrix

Sean invented a game involving a 2n * 2n matrix where each cell of the matrix contains an integer. He can reverse any of its rows or columns any number of times. The goal of the game is to maximize the sum of the elements in the n * n submatrix located in the upper-left quadrant of the matrix. Given the initial configurations for q matrices, help Sean reverse the rows and columns of each matrix in the best possible way so that the sum of the elements in the matrix's upper-left quadrant is max

View Solution →