吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1127|回复: 3
收起左侧

[讨论] 腾讯PCG一面 暑期实习求职面经分享

[复制链接]
chris3will 发表于 2023-4-4 13:03
本帖最后由 chris3will 于 2023-4-4 13:44 编辑

2023.04.04 早上 腾讯会议远程面试

面试官先介绍了一下情况
腾讯PCG base北京 音视频方向 技术栈主要为go

自我介绍

个人信息,岗位匹配程度,与求职意向

项目介绍

两个项目依次介绍
背景,实现了什么,达到什么效果

问:你在项目中遇到最大的困难是什么,问题是如何解决的
问:项目是团队项目?有几个成员?

八股

数据库

数据库中的范式知道吗,其在我们开发中的作用有什么?

回答一下三大范式的各自特点
然后面试官强调,利用范式,能保证一致性,这一点在业务开发中是很重要的。

面试官出了一道题:

用一条SQL语句查询出每门课都大于80分的学生的姓名

很经典,网上也不乏分享,这里提供两种思路

  1. 以学生姓名分组,每组最小的成绩比80分高即可。

    select name 
    from score
    group by name 
    having min(score) > 80;
  2. 先通过子查询找到任意学生有课程分数不高于80,然后再查学生的姓名是否在这个结果中。

    select distinct name 
    from score 
    where name not in 
    (select distinct name 
    from score 
    where grade<=80)

计算机网络

浏览器中输入一个网址之后整个的流程

数据包的变化,经过的协议。

在浏览器中输入网址并按下回车键时,浏览器会向服务器发送一个 HTTP 请求。HTTP 是一种协议,它定义了客户端和服务器之间的通信规则。请求包含有关所请求资源的信息,例如 URL、请求方法(例如 GET 或 POST)和请求头。服务器将根据请求返回响应,响应包含有关所请求资源的信息,例如状态代码、响应头和响应正文。在此过程中,数据包会经过多个网络设备(例如路由器和交换机),并且可能会使用多个协议(例如 TCP 和 IP)进行传输。

协议方面,HTTP, DNS, TCP, IP, ARP, ICMP...

更具体的可以参考小林coding
网络拓扑模型

概括起来,这是一个装包和拆包的过程。只有不断地封装,我们才能进入不同的OSI层小林coding的网络传输报文变化图

挥手握手

为什么三次握手,两次握手可以吗?

参考
第一次握手:客户端发送一个SYN包,指定自己的初始序列号,请求建立连接。

第二次握手:服务器收到SYN包后,发送一个ACK包作为响应,同时也发送一个SYN包,指定自己的初始序列号。这个SYN包表示服务器已经接受了客户端的请求,并准备好建立连接。

第三次握手:客户端收到服务器的SYN包后,发送一个ACK包作为响应。这个ACK包包含服务器的初始序列号加1,表示客户端已经准备好与服务器通信了。

三次握手的主要目的是防止网络中的重复数据包和错误的连接请求。如果只进行两次握手,可能会出现以下问题:

  1. 服务器端可能会收到客户端的重复连接请求。由于网络时延等原因,客户端的第二个连接请求可能会在第一个请求响应之前到达服务器端,从而导致服务器端建立两个连接。

  2. 客户端可能会收到来自不同服务器的响应,从而建立多个连接。如果只进行两次握手,客户端可能会收到来自之前连接过的服务器的响应,从而建立了一个错误的连接。

代码

代码主要进行了两个

  1. 实现两个字符串的字典序比较,a < b返回-1, a = b返回0,a > b返回1
  2. 给一段文本,统计各单词出现的次数并按照单词字典序进行输出。

对于问题1的实现

可参考示例

// Java program to Compare two strings
// lexicographically
public class GFG {

                // 用三元表达式对判别结果进行优化,提高可读性,并满足题干要求
                public static int valid(int x){
                        return x > 0 ? 1 : (x == 0 ? 0 : -1);
                }
    // This method compares two strings
    // lexicographically without using
    // library functions
    public static int stringCompare(String str1, String str2)
    {

        int l1 = str1.length();
        int l2 = str2.length();
        int lmin = Math.min(l1, l2);

        for (int i = 0; i < lmin; i++) {
            int str1_ch = (int)str1.charAt(i);
            int str2_ch = (int)str2.charAt(i);

            if (str1_ch != str2_ch) {
                return valid(str1_ch - str2_ch);
            }
        }

        // Edge case for strings like
        // String 1="Geeks" and String 2="Geeksforgeeks"
        if (l1 != l2) {
            return valid(l1 - l2);
        }

        // If none of the above conditions is true,
        // it implies both the strings are equal
        else {
            return 0;
        }
    }

    // Driver function to test the above program
    public static void main(String args[])
    {
        String string1 = new String("Geeksforgeeks");
        String string2 = new String("Practice");
        String string3 = new String("Geeks");
        String string4 = new String("Geeks");

        // Comparing for String 1 < String 2
        System.out.println("Comparing " + string1 + " and " + string2
                           + " : " + stringCompare(string1, string2));

        // Comparing for String 3 = String 4
        System.out.println("Comparing " + string3 + " and " + string4
                           + " : " + stringCompare(string3, string4));

        // Comparing for String 1 > String 4
        System.out.println("Comparing " + string1 + " and " + string4
                           + " : " + stringCompare(string1, string4));
    }
}

面试官点评时表示,尽量少写三元运算符,业务代码中需要多注释,多直观表达。
对测试用例的选用上要尽可能高效,全面,对边界情况应做到合适的考量。

对于问题2的实现

package org.example;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        // 输入英文文章,输出,按字典序列排序的单词
        String article = "Dennis Behnke, a German management consultant in Shenyang, Northeast China's Liaoning province, has been living in the city for a decade and believes that there is huge potential still in Northeast China.\n" +
                "\n" +
                "\"As a management consultant, I'm helping foreign companies prosper in China, and Chinese companies going global,\" he said, adding that Shenyang is a great place that supports companies with preferential industry policies, and is in a prime location between Beijing, Seoul, Changchun and Dalian. He is optimistic in regards to the development of business, tourism and culture in Shenyang and Northeast China in general.\n" +
                "\n" +
                "As an ardent student of literary Chinese, Dennis is now fluent in Mandarin and Dongbei Hua (Northeast China dialect). He thinks that the improvement of his Chinese skills helps him better understand Chinese culture and makes more friends.\n" +
                "\n" +
                "Watch the video to find out more.\n";
        // 我们只统计单词,要排除标点与空格
        String[] words = article.toLowerCase().replaceAll("[^a-zA-Z]", " ").split("\\s+");

        // 遍历,以及统计各单词出现的次数
        Map<String, Integer> map = new HashMap<>();
        for(String word: words){
            map.put(word, map.getOrDefault(word, 0) + 1);
        }

        // 我们按照字典序排序,并输出结果
        // 利用TreeMap底层排序的特性
        TreeMap<String, Integer> smap = new TreeMap<>(map);
        for(Map.Entry<String, Integer> entry: smap.entrySet()){
            System.out.println("WORD: " + entry.getKey() + " OCCURS: " + entry.getValue() +" TIMES");
        }
    }
}

该问题我们尽可能借助有效的数据结构来优化求解过程。

结束

面试官从各个角度对面试流程进行了总结,并且说明了面试流程,还有十几个同学还在面试,最后会根据这一轮结果排序来决定后续进程。

总的来说,实战面试经验都是很宝贵的,每一次发现一些不足之处,每一次提高自己的稳定性,都是进步。

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

aa702429162 发表于 2023-4-4 15:18
很好的面经,加油
wzbAwxl 发表于 2023-4-4 15:51
外酥内嫩 发表于 2023-4-4 16:04
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-27 20:34

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表