Tuya Smart Interview

This interview is indeed quite rewarding. The interviewer is a master, and the questions asked are relatively classic. Let me talk about a few algorithm questions asked.

1. The IP is stored in the file for you. This file is as big as 20G. Let you count the IPs that appear the most. The memory for you is 20M

2. Give you a list of spam mailboxes, this list has a lot of lists, and then give you a mailbox to let you judge whether it is a spam mailbox.

3. Give you a voice in mp3 format, and let you convert it into Chinese characters (propose ideas).

At the time of the interview, I didn't answer any of them. It was too cruel. At least I had practiced the algorithm for three years. In fact, I could answer the first two after thinking about it. First, let me talk about the problem-solving ideas.

first question:

First of all, there are 2^32 IPs, and the number is relatively large, so it is not acceptable to use array subscripts to count, so we can use a better hash algorithm to group IPs, and then count them in groups.

The hash function I adopted is h(ip)=IP%10000, so that the IP is divided into 10000 parts, each part is unordered and different, but there is an interval range, the following is for each A set of statistics. I use a sorted binary tree for statistics, and the left and right subtrees and IP times are stored on the nodes.

Finally, traverse the binary tree to know which one appears the most

Second question:

Divide the mailing list into a, b, c... 26 files according to the first letter

It is further divided into files with sub-digits a, b, c..., so that you can keep looking down.

The third question is not yet solved, and then recompile when it is solved.

I thought that the algorithm problem was a must to get points, but I didn't get any points, and my mentality exploded.

The following is to ask the Java question,

1. The method of creating a thread, which I answered, is that the words cannot be spelled and written.

Then I asked when these two methods are suitable, that is, the advantages of both. Sometimes, when creating a thread, only the interface must be realized, and there is still no summary, alas.

2. Why the index in the SQL statement can optimize the SQL statement. I just answered that this index is equivalent to a hash value, but the interviewer did not approve of this answer, just saying that this is not an official answer, I only know this about this question, ah, once again my mentality exploded, I can only answer casually, I only know about these, actually I read the index in the afternoon and forgot.

3. How to check the memory of jvm? I understand this problem as checking the memory problem of the ubuntu system, but I can only say that I have not understood it, and explain that we are now troubleshooting on eclipse. Obviously the interviewer will contradict you.

Just remember these questions and forget the rest.

Finally, I asked the interviewer what aspects of study I still need to do. Of course, I already knew that I would definitely not be able to enter the job. The answer was too poor, so I asked myself what I lacked, and I went on to make up for it. well!

       I went to the interview three hours in advance, and I was still sitting in the housing provident fund office for 2 hours, reviewing the algorithm, it was still GG, let’s continue to work hard. The basics still need to be known.

 

 


Guess you like

Origin blog.csdn.net/zs520ct/article/details/79810447