Let's give you a word a. If another word B can be obtained by exchanging the letter order in the word, B is defined as the brother word of. Now I will give you a dictionary. You can enter a word to find out the number of brothers in the dictionary.

Source: Internet
Author: User

If a word is exchanged for its alphabetic order, the obtained words are called sibling words. For example, Mary and army are sibling words. That is, the letters contained are the same, but the alphabetic order is different, when a user inputs a word, he/she needs to find all the brothers of the word in a dictionary and output the word. The corresponding data structure and algorithms are provided. Requires as low time and space complexity as possible

Current ideas:

Struct {

Char data;

Int n

};

According to the mathematical theorem, any natural number N greater than 1 can be uniquely divided into the product N = (P_1 ^ A1) of a finite prime number) * (P_2 ^ A2 )...... (P_n ^ An), here P_1 <P_2 <... <P_n is a prime number and is unique.

For example

A = 2 B = 3 c = 5 d = 7 E = 11...

F (ABCD) = 2*3*5*7 = 210

Then, the number of digits with the product of 210 in the dictionary must be the same as the five-letter combination.

Unknown Source

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.