Add descriptions to each exercise

This commit is contained in:
Camden Dixie O'Brien 2023-12-11 15:37:55 +00:00
parent 17f44d6fec
commit 7c95a358ad
13 changed files with 44 additions and 0 deletions

View File

@ -1,3 +1,5 @@
-- Description
--
-- Solution --------------------------------------------------------------------
function f()
-- Your implementation here

View File

@ -1,3 +1,7 @@
-- Implement the is_anagram() function below, so that it returns true if
-- the two passed strings are anagrams of each other. Any non-
-- alphabetical characters in the string should be ignored.
--
-- Solution --------------------------------------------------------------------
function is_anagram(str1, str2)
-- Your implementation here

View File

@ -1,3 +1,7 @@
-- Implement is_balanced(), which should return true or false depending
-- on whether the brackets in the input string are balanced,
-- i.e. there is a closing bracket for each opening one.
--
-- Solution --------------------------------------------------------------------
function is_balanced(input)
-- Your implementation here

View File

@ -1,3 +1,5 @@
-- Write a function to calculate the nth fibonacci number.
--
-- Solution --------------------------------------------------------------------
function nth_fibonacci_number(n)
-- Your implementation here

View File

@ -1,3 +1,7 @@
-- The greatest common divisor (GCD) of two numbers X and Y is, as the
-- name suggests, the largest number which evenly divides both X and
-- Y. Implement the function below to calculate this.
--
-- Solution --------------------------------------------------------------------
function greatest_common_divisor(x, y)
-- Your implementation here

View File

@ -1,3 +1,8 @@
-- The hamming distance is the number of positions in which two
-- strings differ, and is used to measure how similar strings are.
-- Implement the hamming_distance() function below to calculate this;
-- you may assume that the strings are of equal length.
--
-- Solution --------------------------------------------------------------------
function hamming_distance(str1, str2)
-- Your implementation here

View File

@ -1,3 +1,6 @@
-- Write a function to return the hexadecimal representation (in a
-- string) of a number. Use lowercase a to f.
--
-- Solution --------------------------------------------------------------------
function hexadecimal(x)
-- Your implementation here

View File

@ -1,3 +1,6 @@
-- Implement is_leap_year() below, returning whether the given year is
-- a leap year according to the Gregorian calendar.
--
-- Solution --------------------------------------------------------------------
function is_leap_year(year)
-- Your implementation here

View File

@ -1,3 +1,5 @@
-- Implement a function to return the largest value in a list.
--
-- Solution --------------------------------------------------------------------
function maximum(list)
-- Your implementation here

View File

@ -1,3 +1,7 @@
-- Implement is_palindrome(), which should return whether the passed
-- string is palindromic (i.e the same forwards as it is backwards).
-- Ignore non-letters and case.
--
-- Solution --------------------------------------------------------------------
function is_palindrome(str)
-- Your implementation here

View File

@ -1,3 +1,5 @@
-- Write a function to determine whether a given number is prime.
--
-- Solution --------------------------------------------------------------------
function is_prime(x)
-- Your implementation here

View File

@ -1,3 +1,8 @@
-- Implement the function is_queen_threat() below. It should return
-- true if the queen is threatening the pawn and false otherwise. The
-- coordinates are as given as file (A-H), rank (1-8) pairs such as B3
-- and D7.
--
-- Solution --------------------------------------------------------------------
function is_queen_threat(queen_position, pawn_position)
-- Your implementation here

View File

@ -1,3 +1,7 @@
-- Write a function to determine the resistance (in ohms) of a given
-- three-part resistor colour code. The colour code is passed as a
-- list of strings.
--
-- Solution --------------------------------------------------------------------
function decode_resistance(colours)
-- Your implementation here