Where to answer questions 2015-R & D

Source: Internet
Author: User
1. Binary Search of ordered Series

The simplest and purest problem of binary lookup is that if we use a circular method, the score will be higher.

2. Search for the first character that appears twice

For example:The first string that appears twice in the string "yactysa" is 'y'

Solution 1:O (N ^ 2) efficiency. That is, the simplest dual-loop.

Solution 2:It is better to use more hash methods. Define an array of 256.

3. Search for the "your" sub-string among multiple strings and sort them by the number of occurrences

Detailed question: a text input is provided. All rows containing the sub-string "your" must be output, regardless of case. In addition, the row is output in ascending order of the number of times your appears.

The KMP algorithm is easy to think of when dealing with substrings. However, every letter in "your" is unique, so you can simplify the judgment. If there are different characters, you can directly compare the current position with the character whose substring subscript is 0.

Where to answer questions 2015-R & D

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.