Skip to content

APL Quest 2017 Problems

2017-1: What an Odd Bunch:

Write a function that will return the first n odd natural numbers.

2017-2: Good Evening:

Write a function that takes an integer array and replaces all the odd numbers with the next greater even number.

2017-3: Miss Quoted:

Write a function that will remove text found between pairs of double quotes.

2017-4: Slice(s) of Pie(s):

Write a function that calculates and returns the areas of 0 or more pie slices.

2017-5: DNA?:

Write a function that takes a string representing a nucleotide and returns a `1` if it is a valid DNA string, `0` otherwise.

2017-6: k-mers:

Write a function that takes a character vector as its right argument and k (the substring length) as its left argument and returns a vector of the k-mers of the original string.

2017-7: Counting DNA Nucleotides:

Write a function that takes a character vector representing a DNA string and returns 4 integers of the number of occurrences for each of the symbols 'A', 'C', 'G', and 'T' respectively.

2017-8: Be the First 1:

Write a function that takes a Boolean vector or scalar and “turns off” all the 1s after the first 1.

2017-9: Double Trouble:

Write a function that takes a character vector or scalar and returns a Boolean vector indicating anywhere an element is followed by an element of the same value.

2017-10: Squaring Off:

Write a function that will reshape a given array into the smallest square matrix that will contain all the elements of the argument, padding with additional elements if necessary.