Web 后端招新题目
Web 后端招新题目
后端题型分为 Http Server, 数据库操作, Go 语言三大类,挑选一类题目做即可
如果不会做填“不会”即可
Http Server
1.
使用任何编程语言或框架,构建一个包含以下 api 的 http server
a.
基础接口: Get /api/greet; Response {"message":"hello,world!"}
b.
读取 query 中的 name 信息,并做出与 name 对应的响应:Get /api/users?name=xxx ; Response {"message":"hello,xxx!","time":"2023-03-11 23:30:00"}。其中 time 字段表示请求时间。
数据库操作
1.
We have a dog's table that looks like this:
代码块
CREATE TABLE dog (
dog_id integer,
owner_id integer,
name varchar,
breed varchar,
age integer
);
a. Write a query that lists the 5 oldest dogs’ name and age. Break ties by the dog’s name in ascending alphabetical order.
b. Write a query that shows how many dogs we have for each breed, but only for breeds that have multiple dogs.
Go 语言基础
1.
给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出和为目标值 target 的那两个整数,并返回它们的数组下标。你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。你可以按任意顺序返回答案。
代码块
func twoSum(nums []int, target int) []int {
}