An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. For example, the word anagram can be rearranged into nag a ram, or the word binary into brainy or …
Read MoreCount the string occurrences
You are given two strings T and P. Write a program, which counts how many time P is found in T. If different occurrences of P in T overlap count each one of them. Here is an example: T = babalabalabalatheend P = alabala The …
Read MoreGroup words with same set of characters
Given a list of words with lower cases. Implement a function to find all Words that have the same unique character set . Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Input: words[] = { "may", "student", "students", "dog", "studentssess", "god", "cat", "act", "tab", "bat", "flow", "wolf", "lambs", "amy", "yam", "balms", "looped", "poodle"}; Output : looped, poodle, lambs, balms, flow, wolf, tab, bat, may, amy, yam, student, students, studentssess, dog, god, cat, act, All words with same set of characters are printed together in a line. |
Solution
Read More