title-img


HackerRank in a String!

We say that a string contains the word hackerrank if a subsequence of its characters spell the word hackerrank. Remeber that a subsequence maintains the order of characters selected from a sequence. More formally, let p[0] , p[1], . . . , p[9] be the respective indices of h, a, c, k, e, r, r, a, n, k in string s. If p[0] < p[1] < p[2] , . . . , < p[9] is true, then s contains hackerrank. For each query, print YES on a new line if the string contains hackerrank, otherwise, print NO.

View Solution →

Pangrams

A pangram is a string that contains every letter of the alphabet. Given a sentence determine whether it is a pangram in the English alphabet. Ignore case. Return either pangram or not pangram as appropriate. Example s = "The quick brown fox jumps over a lazy dog" The string contains all letters in the English alphabet, so return pangram. Function Description Complete the function pangrams in the editor below. It should return the string pangram if the input string is a pangram. O

View Solution →

Weighted Uniform Strings

A weighted string is a string of lowercase English letters where each letter has a weight. Character weights are 1 to 26 from a to z as shown below: The weight of a string is the sum of the weights of its characters. For example: A uniform string consists of a single character repeated zero or more times. For example, ccc and a are uniform strings, but bcb and cd are not. Function Description Complete the weightedUniformStrings function in the editor below. weightedUniformStrin

View Solution →

Funny String

In this challenge, you will determine whether a string is funny or not. To determine whether a string is funny, create a copy of the string in reverse e.g. abc -> cab. Iterating through each string, compare the absolute difference in the ascii values of the characters at positions 0 and 1, 1 and 2 and so on to the end. If the list of absolute differences is the same for both strings, they are funny. Determine whether a give string is funny. If it is, return Funny, otherwise return Not Funny

View Solution →

Gemstones

There is a collection of rocks where each rock has various minerals embeded in it. Each type of mineral is designated by a lowercase letter in the range ascii[ a - z ]. There may be multiple occurrences of a mineral in a rock. A mineral is called a gemstone if it occurs at least once in each of the rocks in the collection. Given a list of minerals embedded in each of the rocks, display the number of types of gemstones in the collection. Function Description Complete the gemstones func

View Solution →