title: 2021年4月27日 深圳头条后台开发实习面试(四面)
tags: 面经
2021年4月27日 深圳头条后台开发实习面试(四面)
自我介绍
项目介绍(每次介绍项目一定要详细点,比如你做了什么,怎么做的,做的效果是什么呢,以及遇到的最大困难是什么呢,你是如何解决的呢,然后之后你打算怎么做呢)
Java中面向对象是怎样一回事呢?(这个地方感觉还不好答,可以试着把面向对象的一些好处说一下)
Java中的final的关键字
HashMap、HashTable和HashSet之间的区别
Java中的引用类型有哪些呢?(强引用,弱引用,软引用,虚引用),以及它们之间的区别
Java中锁有哪些呢?(synchronized、lock、CAS),再比较一下这三者
MySQL底层存储引擎,以及比较一下这两者的区别
手撕算法题--顺时针打印数组。(螺旋矩阵)
反问环节
手撕算法题

class Solution {
public List<Integer> spiralOrder(int[][] matrix) {
if(matrix == null || matrix.length == 0 || matrix[0].length == 0){
return new ArrayList<Integer>();
}
List<Integer> list = new ArrayList<>();
int rows = matrix.length, cols = matrix[0].length;
int left = 0, right = cols - 1, top = 0, bottom = rows - 1;
while(left <= right && top <= bottom){
for(int col = left; col <= right; col++){
list.add(matrix[top][col]);
}
for(int row = top + 1; row <= bottom; row++){
list.add(matrix[row][right]);
}
if(left < right && top < bottom){
for(int col = right - 1; col > left; col--){
list.add(matrix[bottom][col]);
}
for(int row = bottom; row > top; row--){
list.add(matrix[row][left]);
}
}
left++;
right--;
top++;
bottom--;
}
return list;
}
}