2019 school recruiting Tencent interview experience---iOS/macOS development internship


1. Introduce yourself
2. Tell me about your project

0. Project design.
1. The essence of the project.
2. What technical difficulties did you encounter in the project?

3. What iOS books have you read?

(Answered: "iOS Performance Optimization", "iOS Database Advanced Programming", "iOS Advanced Programming", "Effective Objective-C", "iOS Development", "Objective-C Memory Management", "Objective-C Basic Programming" etc.)
4.

4. iOS memory management

0. Which memory management mechanisms does iOS have (GC, ARC, MRC answered)
1. The difference between ARC and MRC
2. Talk about the understanding of weak and strong
3. Send a message to an object with a reference count of 0 , the program will crash, how to avoid this situation. (rewrite of answer)

Five, import and include

0. The difference between import and include
1. How to make include and import function the same?
(The answer is to use lazy loading)
2. Tell me about the idea of ​​how to use lazy loading to achieve.

Six, copy and strong

0. Understanding of copy and strong
1. Is the object after NSMutableArray copy mutable or immutable?
2. Why is it mutable

Seven, block block.

0. Can you modify external variables?
1. Why not?

8. OC/C/C++

0. The similarities and differences of OC/C/C++.
1. Which is faster when OC and C++ do processing? (The answer is C++ is faster)
2. Why is C++ faster under the analysis? ? (The answer C++ is a static compiled language, and oc is a dynamic language with runtime overhead in the middle)

9. Message forwarding.


Attachment: (written test questions)

Topic description:

Xiao Q's company recently received m tasks, the i-th task takes xi time to complete, and the difficulty level is yi. Xiao Q has n machines, each machine has the longest working time zi and machine level wi.
For a task, it can only be completed by one machine. If the longest working time of the machine assigned to it is less than the time required for the task, it cannot be completed. If the task is completed, it will get 200*xi+3*yi income.
For a machine, it can only complete one task a day, if its machine level is less than the task difficulty level assigned to it, it cannot be completed.
Xiao Q wants to complete the task as much as possible today, that is, to complete the largest number of tasks. If there are multiple arrangements, Xiao Q also wants to find the one with the greatest benefit.
Input description: The
input includes N+M+1 lines, and
the first line of the input is two positive integers n and m (1<=n, m<=100000), indicating the number of machines and the number of tasks.
The next n lines, each line contains two integers xi and yi (0<xi<1000, 0<=yi<=100), indicating the maximum working time and machine level of each machine.
Next m lines, each line contains two integers zi and wi (0<zi<1000, 0<=wi<=100), indicating the completion time required for each task and the difficulty level of the task.
Output description:
Output two positive integers, which represent the maximum number of tasks that can be completed and the income obtained.
Example 1:
Input
[plain] view plain copy
1 2
100 3
100 2
100 1
Output
[plain] view plain copy
1 20006

Code
//思路:贪心算法
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct A
{   int x;
    int y;
}t[100010], m[100010];
bool cmp(A a, A b)
{
    if(a.x != b.x)return a.x > b.x;
    return a.y > b.y;
}
int main()
{
    int N, M;
    scanf("%d %d", &N, &M);
    for(int i = 0; i < N; i++)
        scanf("%d %d", &m[i].x, &m[i].y);
    for(int j = 0; j < M; j++)
        scanf("%d %d", &t[j].x, &t[j].y);
    sort(t, t + M, cmp);
    sort(m, m + N, cmp);
    long long sum = 0;
    int count = 0;
    int mark[100010]={0};
    int j = 0;
    for(int i = 0; i < M; i++)
    {
        while(j < N && m[j].x >= t[i].x)
        {
            mark[m[j].y]++;
            j++;
        }
        for(int k = t[i].y; k <= 100; k++)
        {
            if(mark[k])
            {
                mark[k]--;
                count++;
                sum += (long long)(200 * t[i].x + 3 * t[i].y);
                break;
            }
        }
    }
    printf("%d %lld\n", count, sum);
    return 0;
}

Remark:

I remember that when I was a sophomore, I participated in Tencent's school recruitment, and after submitting my resume, I didn't even have a chance to take the written test. This year, I was very fortunate to pass the written test and participate in the interview.
In terms of school recruitment, Tencent actually pays more attention to the foundation of a person, the perspective and depth of thinking about problems. It's not how many projects you've done. How much project experience you have.
Whether you pass or fail this time, you are determined to prepare for the postgraduate entrance examination. Ocean University of China!
In the future, the speed of blog updates will not be so frequent. (Of course, still strive for the end of the year, CSDN ranking into the top 20,000)
Take this opportunity to thank every friend who pays attention to my blog, thank you.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325609376&siteId=291194637