Skip to content

Latest commit

 

History

History
32 lines (18 loc) · 2.18 KB

readme.md

File metadata and controls

32 lines (18 loc) · 2.18 KB

CoderByte-Challenges-Solutions

Coding Challenges Solutions at coderbyte.com

String Challenge

Have the function StringChallenge(strArr) take the array of strings stored in strArr, which will contain only two strings, the first parameter being the string N and the second parameter being a string K of some characters, and your goal is to determine the smallest substring of N that contains all the characters in K. For example if strArr is [aaabaaddae, aed] then the smallest substring of N that contains the characters a, e, and d is dae located at the end of the string. So for this example your program should return the string dae.

Another example if strArr is [aabdccdbcacd, aad] then the smallest substring of N that contains all of the characters in K is aabd which is located at the beginning of the string. Both parameters will be strings ranging in length from 1 to 50 characters and all of K's characters will exist somewhere in the string N. Both strings will only contains lowercase alphabetic characters.

Examples

Input [ahffaksfajeeubsne, jefaa]

Output aksfaje

Input [aaffhkksemckelloe, fhea]

Output affhkkse

Array Challenge (LIS: Longest Increasing Subsequence)

Have the function StringChallenge(strArr) take the array of strings stored in strArr, which will contain only two strings, the first parameter being the string N and the second parameter being a string K of some characters, and your goal is to determine the smallest substring of N that contains all the characters in K. For example if strArr is [aaabaaddae, aed] then the smallest substring of N that contains the characters a, e, and d is dae located at the end of the string. So for this example your program should return the string dae.

Another example if strArr is [aabdccdbcacd, aad] then the smallest substring of N that contains all of the characters in K is aabd which is located at the beginning of the string. Both parameters will be strings ranging in length from 1 to 50 characters and all of K's characters will exist somewhere in the string N. Both strings will only contains lowercase alphabetic characters.

Examples

Input: [9, 9, 4, 2]

Output: 1

Input: [10, 22, 9, 33, 21, 50, 41, 60, 22, 68, 90]

Output: 7