Home > Common Problem > body text

Several questions to determine whether you can enter Byte

Release: 2023-08-25 15:48:00
forward
587 people have browsed it

1 Job Description

  • Responsible for the security systems and products of Bytedance’s business line (including Toutiao, Douyin, Huoshan, etc.) Design and development
  • Improving the security capabilities of automated tools within the platform
  • Responsible for the general security modules of Toutiao, Douyin, Huoshan and other products, Design and development of components

2 Job requirements

  1. Bachelor degree or above
  2. Proficient in various development skills on Linux/Mac/Windows platforms
  3. Proficient in one or more of the following languages, Java/Python/Go/C, etc.
  4. Familiar with commonly used algorithms and data structures, familiar with network programming and multi-thread programming technology
  5. Good at learning and applying new knowledge, with good analysis and problem solving skills Ability
  6. Have good teamwork spirit and proactive communication awareness

Extra points

  1. Have a background in security product development is preferred
  2. Have a good understanding of security development, security testing, vulnerability detection and other security knowledge

3 Interview

The interviewer briefly confirms the candidate’s name at and asks the candidate’s current place of employment After that, he saidYou should understand Byte’s interview process, right?

My friend was confused because he had never participated in Byte's interview before, and askedWhat is the process? This is my first time to participate in Byte. Interview.

The interviewer replied First do a few algorithm questions. Seeing that your resume says you have done a lot of hard-hitting questions, then write a simple question first as an appetizer.

Then the interviewer started to ask questions.

My friend (who has heard that the byte algorithm question is not easy before) thought to himself What's the fuck, your simple question won't be particularly difficult, right?

3.1 Programming Question 1

请写一个函数:string ConvertNum(string src, int src_base, int dst_base)

测试用例:
ConvertNum("FF", 16, 10) = "255"
ConvertNum("077", 8, 10) = "63"
ConvertNum("10", 16, 10) = "16"

假设:
参数:src_base/dst_base = 2, 8, 10, 16 src >= "0"
假设没有任何前缀;
假设参数都正确;
假设参数都是非负数
Copy after login

Interviewer Requirements

Complete within 20 minutes, the sooner the better, it is required to pass all test cases and the code is as concise as possible.

Friend

I haven’t answered this kind of question for a long time. After seeing the question, I didn’t think clearly,The operation was as fierce as a tiger, which resulted in many details being missed. question.

Problem-solving ideas (mainly examine knowledge points:)

1. Convert strings to integers Implementation of function atoi;

2. Conversion between hexadecimal systems;

3. Implementation of function itoa for converting integers into strings.

A seemingly simple basic question examines a lot of things, and it requires to adopt the idea of ​​"divide and conquer" .

My friend told the interviewer that I usually brush leetcode, but suddenly I feel uncomfortable writing this kind of question.

The interviewer replied Let’s look at a similar question that is very difficult to answer.

The interviewer began to ask questions.

3.2 面试题二

C++
typedef struct LinkListNode {
  int value;
  struct LinkListNode* left;
  struct LinkListNode* right;
} LN, *PLN;

bool IsBranch(PLN root, int *nodes, int length)
   1
  / \
 2   3
    / \
   4   5
      / \
     6   7
     
1 T
0 F
2, 3 F
1, 2, 3 T
1, 3, 5, 6 T
6, 5, 3, 1 T
Copy after login

面试官提示

面试官出完题之后,笑了笑说提示一下哈,本题可以找规律

朋友

做了一段时间之后,大部分写出来了,但是还是有些细节没考虑好。

解题思路

将这颗树看成一个族谱,如果输入的是一颗子树的话,必须要有父亲节点,比如 1, 3, 6,由于 6 没有父亲节点,所以输出肯定是 F;如果只有兄弟节点的话,同样输出也是 F。

面试官问 你刷题的时候,最擅长刷哪种类型的题目,数组 or 链表 or 二叉树 or 排序 or...?

朋友一想,最近自己刷 链表 的题目比较多,递归、迭代以及增加虚拟头节点等等解法都掌握了,而且听了慕课网 liuyubobo 老师的算法课中的链表部分,于是自豪地说 链表

面试官说 那就看看链表的算法题吧

朋友露出笑容问道 面试官,你不会出一道 hard 的链表题吧?

面试官哈哈大笑,答道 我还是有节操的,不会坑你的,不过如果你通过了这一面,下一面的算法题估计比较难

说完面试官出题了。

3.3 面试题三

给定一个单链表,在链表中把 L 个节点到 R 个节点这一部分进行反转。

示例1:
输入
[1, 2, 3, 4, 5]  1, 3
输出
{3, 2, 1, 4, 5}
Copy after login

朋友一看,面露喜色,这么简单的,而且这不跟力扣中某道题类似嘛?

面试官好像看出来啥了,笑着问 你如果做过这道题的话,你就说做过,我再给你换道题

朋友答道 确实做过,哈哈。

面试官开始换题(出题)。

3.4 面试题四

将一个链表 m 位置到 n 位置之间的区间反转,要求时间复杂度,空间复杂度。

例如:
给出的链表为 1->2->3->4->5->NULL,返回 1->4->3->2->5->NULL.

注意:
给出的满足一下条件:
1 ≤ m ≤ n ≤ 链表长度。
Copy after login


朋友一看,笑了,心想这不就是 leetcode 92. 反转链表 II 的原题嘛?于是乎很诚实地跟面试官说 这题我做过

面试官面露微笑,说 继续换题,不过不用担心,我不坑你,做一道合并两个排序链表的题

朋友听到 合并两个排序数组心中一顿窃喜,这不还是 leetcode 原题嘛?

3.5 面试题五

合并排序数组
typedef struct LinkListNode {
  int value;
  struct LinkListNode *next;
}LN, *PLN;

示例:
listA 升序(1, 3, 5, 7, 9)
listB 降序(8, 6, 4, 2, 0)
返回:升序(0, 9)
PLN mergeLinkList(PLN listA, PLN listB)
Copy after login

面试官果真不坑人,笑着说我提示一下哈 为了简单一点,这道题你可以不用考虑这两个链表中有相同值得节点

朋友一想,这不简单嘛,力扣中已经刷过原题(合并两个已升序排列的链表),这道题只需要 把链表 B 反转一下,这是链表 B 就有序了,这样不就跟力扣的原题完全一毛一样了嘛,心中一顿窃喜,于是刷刷刷地写完了。

面试官看了看,说 如果链表 B 中的最后一个节点的值都大于链表 A 的最后一个节点的值呢?如果链表 B 中的第一个节点的值都小于链表 A 的第一个节点的值呢

朋友想了想,好像也是,还要考虑 链表 B 中每个节点的值放到链表 A 中的什么位置,这还得遍历整个链表 B 和 链表 A,并跟面试官说了。

面试官说这就是本题的难点

解题思路

考虑几种特殊情况。

1、链表 A 和链表 B 都为空,直接返回即可。

2、链表 A 不为空,链表 B 为空,直接返回链表 A。

3、链表 A 为空,链表 B 不为空,翻转链表 B 并返回翻转后的链表 B。

4. If neither linked list A nor linked list B is empty, traverse linked list A and linked list B and insert the nodes in linked list B (from back to front) into linked list A, and record the insertion position. .

The interviewer smiled and said This question is actually meant to bully those of you who are already working. Those students who have time can answer the questions every day and become very proficient.

Summary

This interview, "Divide and Conquer Thought"There are many exams. A programming question can often be divided into several simple small programming questions. Only these small programming questions Only after you can learn AC can you combine them into big questions AC.

The above is the detailed content of Several questions to determine whether you can enter Byte. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:Java后端技术全栈
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!