[Algorithm] algorithms used by major online users on po

Source: Internet
Author: User

I often see the experts carefully writing their own experiences on various forums. I have never experienced the interview in the workshop and can only learn from them. The algorithms are recorded below. I just thought about it, the lab has been too busy over the past few days and must be implemented in person if you have time!

[Hulu interview] http://bbs.byr.cn /#! Article le/ParttimeJob/314786

1. Give an integer sequence to determine whether it is the next traversal of the binary sorting number. (Do not use extra space, consider the time complexity of O (nlgn) and O (n)

2. The given factor is at least 3, 5, and the k-largest number of one of 7.

3. Given a two-dimensional array of n * n, rows are incrementing, columns are incrementing, and integers are not repeated. Then, a number is given to determine whether the number is in a two-dimensional array.

4. Two people A and B are still coins, A is throwing n times, B is throwing n + 1 times, A is facing up x times, and B is facing up y times, q: What is the probability of x> y.

5. Mix 100 white balls and 100 black balls. Take two balls each time. If the color is the same, put the same black ball back. If the color is different, put the same white ball back, calculate the probability of the last black ball.

6. For an integer array, find a continuous sub-sequence of the array. Each element of the sub-sequence and obtain the absolute value of the sub-sequence must be the minimum.

7. How to Find the K-largest number after the two arrays are merged. (Considering the time complexity of O (lgk)

8. If a person knows the price of his or her stock every day in the next n days, please give an algorithm so that the person can obtain the maximum benefit from buying or selling the stock from the day. (Considering the time complexity of O (nlgn)


[Public comments written test]

Http://ilovers.sinaapp.com/drupal/article/2013%E5%B9%B4%E5%A4%A7%E4%BC%97%E7%82%B9%E8%AF%84%E5% AE %9E%E4%B9%A0%E7%94%9F%E6%8B%9B%E8%81%98%E7%AC%94%E8%AF%95%E9%A2%98%E7%9B% AE

1. From AM to AM, How many times does the second and minute breaks meet?

2. Find the nth reciprocal node of a one-way linked list. function prototype: node fun (node * head, int n)

3. a matrix of N * N. Each row is ordered from left to right, and each column is ordered from top to bottom. A program is written to determine whether a number is in the matrix.


[Baidu interview]

1. Implement a stack using two queues

2. No number is written for the four dice. Please write a number so that the four dice can represent any day of the year on the seventh day. (After thinking about this question, it should be converted to a hexadecimal system)

Not complete...

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.