Sorted Array of Words

Published by Mubashir Hassan in

The function is given an array of words and a new alphabet (English letters in different order). Determine if the array of words is sorted lexicographically. The words consist of lower case letters.

Examples

is_sorted(["hello", "edabitlot"], "hlabcdefgijkmnopqrstuvwxyz") ➞ true

is_sorted(["word", "world", "row"], "worldabcefghijkmnpqstuvxyz") ➞ false

is_sorted(["apple", "app"], "abcdefghijklmnopqrstuvwxyz") ➞ false

is_sorted(["deceased", "folks", "can", "vote"], "abdefghijklmnopqrstcuvwxyz") ➞ true

Notes

N/A

Watch a quick demo on how Edabit works.