Skip to content

Side Program Ideas

Victoria Brown edited this page Jan 17, 2019 · 1 revision

Student's Final Grade:

Create a function finalGrade, which calculates the final grade of a student depending on two parameters: a grade for the exam and a number of completed projects.

Maximum Subarray Sum:

The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers:

maxSequence [-2, 1, -3, 4, -1, 2, 1, -5, 4] -- should be 6: [4, -1, 2, 1] Easy case is when the list is made up of only positive numbers and the maximum sum is the sum of the whole array. If the list is made up of only negative numbers, return 0 instead.

Empty list is considered to have zero greatest sum. Note that the empty list or array is also a valid sublist/subarray.

Shortest Knight Path

Given two different positions on a chess board, find the least number of moves it would take a knight to get from one to the other. The positions will be passed as two arguments in algebraic notation. For example, knight("a3", "b5") should return 1.

The knight is not allowed to move off the board. The board is 8x8.

Bloxorz Solver:

Objective Your goal is to maneuver a rectangular cuboid with dimensions 1 x 1 x 2 on a 2-dimensional grid made up of 1 x 1 square tiles. While moving the cuboid around, your block must never, at any point, have any part of its bottom-facing surface exposed to open air (the exit is an exception to this rule).

Input Your function will receive an array of strings describing the layout of the grid to be traversed. A 1 represents solid ground (tiles), a 0 represents open air, a B represents your starting position, and an X represents the square hole (destination).

Output Your function must return a string representing the minimum sequence of moves required to get the block into the square hole. It will consist of a combination of the following characters: U (up), D (down), L (left), R (right).

Regular Expression for Binary Numbers Divisible by n

Create a function that will return a regular expression string that is capable of evaluating binary strings (which consist of only 1s and 0s) and determining whether the given string represents a number divisible by n.

Tests Inputs 1 <= n <= 18 will be tested

Each n will be tested against random invalid tests and random valid tests (which may or may not pass the regex test itself, accordingly).

Notes Strings that are not binary numbers should be rejected. Keep your solution under 5000 characters. This means you can't hard-code the answers. Only these characters may be included in your returned string: 01?:*+^$()[]|