【备战春招必看】美团2025届春招第 9套笔试解析 | 大厂真题通关指南
✅ 春招备战指南 ✅
💡 学习建议:
- 先尝试独立解题(建议用时:90分钟/套)
- 对照解析查漏补缺
- 配套练习题库
互联网必备刷题宝典🔗
📢 美团技术岗笔试重要信息速览
⏰ 笔试时间安排
- 常规场次:每周六交替进行
- 上午场 10:00~11:30
- 晚间场 19:00~20:30
- 通知时间:每周四/五通过邮箱发送考试链接
🧩 笔试题型分布
| 算法岗 | 选择题 + 5道编程 |
| 后端开发岗 | 选择题 + 3道编程 |
| 前端/测试岗 | 选择题 + 2道编程 |
⚙️ 考试设置要点
- 考试平台:牛客网(ACM模式)
- 监考要求:
- 必须开启笔记本前置摄像头
- 禁止使用手机(需小程序锁定)
- 允许使用本地IDE
- 编程规范:
- 严格遵循输入输出格式
- 注意时间复杂度控制(通常1s对应1e8次运算)
📚 笔试经验贴
(所有展示题面均已进行改编处理,保留核心考点)
本题库收录整理自:
- 互联网公开的笔试真题回忆版(经网友投稿)
- 各大技术社区公开讨论的经典题型
- 历年校招考生提供的解题思路
🔍 题库特点:
- 100%真实笔试场景还原
- 包含高频考点题型
- 提供多语言实现参考
- 持续更新2024届最新真题
⚠️ 注意事项:
- 所有题目均来自公开渠道,已进行改编脱敏处理
- 实际笔试可能出现题型变化,请以官方通知为准
🚀 春招备战指南
金三银四求职季即将到来!这里整理了最新美团真题及解析,助你快速掌握笔试套路。建议重点突破以下题型:
- 数组/字符串操作
- 树形结构应用
- 贪心/动态规划
- 区间合并问题
(👇 下附最新笔试真题及详细解析 👇)
真题详解(改编版)
第一题:移动瓶子
题目内容
小基初始位于 位置,二维平面上有
个瓶子,每个瓶子的位置为
。小基每次可以向上、下、左、右移动一格,每次移动的代价为 1。小基需要每次移动到一个瓶子的位置上,然后拿起瓶子把它放到
位置,每次最多只能拿一个瓶子。请问最少需要多少代价才能把所有瓶子都放到
位置上。
输入描述
第一行四个整数 ,表示小基初始位置和瓶子需要放置的位置。 接下来一行一个整数
,表示瓶子的数量。 接下来
行,每行两个整数
,表示第
个瓶子的位置。
输出描述
输出一个整数,表示最少需要多少代价。
样例1
输入:
0 0 1 1
2
1 0
2 2
输出:
6
说明: 先移动到 ,拿起瓶子,移动到
,放下瓶子,代价为 2。 再移动到
,拿起瓶子,移动到
,放下瓶子,代价为 4。
题解
这道题的关键是理解除了第一次从 出发外,后面均是从
出发再回到
。因此需要枚举第一个拿取的瓶子,然后计算其他瓶子到
的路径总和。
时间复杂度: 空间复杂度:
三语言参考代码
- C++
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define N 100010
ll a, b, c, d;
ll site_x[N];
ll site_y[N];
int main(){
int n;
cin >> a >> b >> c >> d;
cin >> n;
ll res = 0;
for(int i = 0; i < n; i++){
cin >> site_x[i] >> site_y[i];
res = res + 2*(abs(site_x[i] - c) + abs(site_y[i] - d));
}
ll temp_res = res;
for(int i = 0; i < n; i++){
temp_res -= 2*(abs(site_x[i] - c) + abs(site_y[i] - d));
temp_res += (abs(site_x[i] - a) + abs(site_x[i] - c) + abs(site_y[i] - b) + abs(site_y[i] - d));
if(temp_res < res){
res = temp_res;
}
temp_res -= (abs(site_x[i] - a) + abs(site_x[i] - c) + abs(site_y[i] - b) + abs(site_y[i] - d));
temp_res += 2*(abs(site_x[i] - c) + abs(site_y[i] - d));
}
cout << res << endl;
return 0;
}
- Python
import sys
a, b, c, d = map(int, input().split())
n = int(input())
X = [0] * n
Y = [0] * n
ans = 0
idx = -1
mx = sys.maxsize
for i in range(n):
X[i], Y[i] = map(int, input().split())
x, y = X[i], Y[i]
t = abs(x - c) + abs(y - d)
dist = abs(x - a) + abs(y - b) - t
if idx == -1 or dist < mx:
idx = i
mx = dist
for i in range(n):
x, y = X[i], Y[i]
ans += 2 * (abs(x - c) + abs(y - d))
ans += mx
print(ans)
- Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong();
long b = sc.nextLong();
long c = sc.nextLong();
long d = sc.nextLong();
int n = sc.nextInt();
long[][] bottles = new long[n][2];
long sum = 0;
for(int i = 0; i < n; i++){
bottles[i][0] = sc.nextInt();
sum += Math.abs(bottles[i][0] - c);
bottles[i][1] = sc.nextInt();
sum += Math.abs(bottles[i][1] - d);
}
sum *= 2;
long res = Long.MAX_VALUE;
long dis = 0;
for(int i = 0; i < n; i++){
dis = Math.abs(bottles[i][0] - a) + Math.abs(bottles[i][1] - b);
res = Math.min(res, sum - Math.abs(bottles[i][0] - c) - Math.abs(bottles[i][1] - d) + dis);
}
System.out.println(res);
}
}
第二题:数字操作
题目内容
小基有三个数字 ,她每次操作可以选择一个数字将其加一,最多可以操作
次。小基想知道
的最大值是多少?
由于这个数字可能很大,因此你需要输出答案对 取模后的结果。
输入描述
第一行四个正整数 表示数字和操作次数。
输出描述
输出一个整数表示答案。
样例1
输入:
1 2 3 1
输出:
12
说明: 对 1 操作一次,三个数字变成 [2,2,3],乘积为 12。
题解
这道题的关键是理解几何不等式:。要使乘积最大,三个数应该尽量相等。因此每次操作应该给最小的数加一。
时间复杂度: 空间复杂度:
三语言参考代码
- C++
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
long long arr[3];
cin >> arr[0] >> arr[1] >> arr[2];
long long k;
long long mod = 1e9+7;
cin >> k;
sort(arr, arr + 3);
long long needed = (arr[2] - arr[0]) + (arr[2] - arr[1]);
if (k >= needed) {
k -= needed;
arr[0] = arr[2];
arr[1] = arr[2];
arr[0] += k / 3;
arr[1] += k / 3;
arr[2] += k / 3;
long long remainder = k % 3;
if (remainder == 1) {
arr[2] += 1;
} else if (remainder == 2) {
arr[1] += 1;
arr[2] += 1;
}
} else {
if (k <= arr[1]-arr[0]){
arr[0] += k;
} else {
k -= arr[1]-arr[0];
arr[0] = arr[1];
arr[0] += k/2+k%2;
arr[1] += k/2;
}
}
long long result = ((arr[0] % mod) * (arr[1] % mod) % mod * (arr[2] % mod)) % mod;
cout << result << endl;
return 0;
}
- Python
a,b,c,k = list(map(int,input().split()))
mod = 10 ** 9 + 7
nums = [a,b,c]
nums.sort()
if 2 * nums[2] - nums[1] - nums[0] < k:
k -= 2 * nums[2] - nums[1] - nums[0]
temp = k // 3
num3 = nums[2] + temp
if k % 3 == 0:
res = num3 ** 3
elif k % 3 == 1:
res = num3 * num3 * (num3 + 1)
else:
res = num3 * (num3 + 1)**2
print(res % mod)
elif nums[1] - nums[0] < k <= 2 * nums[2] - nums[1] - nums[0]:
k -= nums[1] - nums[0]
temp = k // 2
num2 = nums[1] + temp
if k % 2 == 0:
res = num2 * num2 * nums[2]
elif k % 2 == 1:
num1 = num2 + 1
res = num1 * num2 * nums[2]
print(res % mod)
elif k <= nums[1] - nums[0]:
num1 = nums[0] + k
res = num1 * nums[1] * nums[2]
print(res % mod)
- Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long[] nums = new long[3];
nums[0] = in.nextLong();
nums[1] = in.nextLong();
nums[2] = in.nextLong();
long k = in.nextLong();
int MOD = 1000000007;
Arrays.sort(nums);
long sub1 = nums[1] - nums[0];
long sub2 = nums[2] - nums[1];
double ans = 0;
if(k < sub1) {
nums[0] = (nums[0] + k) % MOD;
for(int i = 0; i < 3; i++) nums[i] %= MOD;
ans = nums[0] * nums[1] % MOD * nums[2] % MOD;
System.out.print((long)ans);
return;
}
nums[0] = (nums[0] + sub1) % MOD;
k -= sub1;
if(k/2 < sub2) {
nums[0] = (nums[0] + k/2 + (k%2==1?1:0)) % MOD;
nums[1] = (nums[1] + k/2) % MOD;
for(int i = 0; i < 3; i++) nums[i] %= MOD;
ans = nums[0] * nums[1] % MOD * nums[2] % MOD;
System.out.print((long)ans);
return;
}
nums[0] = (nums[0] + sub2) % MOD;
num
剩余60%内容,订阅专栏后可继续查看/也可单篇购买
互联网刷题笔试宝典,这里涵盖了市面上大部分的笔试题合集,希望助大家春秋招一臂之力
OPPO公司福利 1091人发布