shopee测试笔试题7.21凉

许愿能够找到工作。
作为秋招的记录吧,菜的不行。哎。
感谢信来得太快,7.22收到了感谢信。
20道选择题
1.视图的优点是什么
2.n个叶节点的Huffman树节点总数是多少
3.链接方式存储队列,什么情况会更改头尾节点
4.ACID具体场景应用,选那个原则
5.ethernet MTU是多少
6.403代表啥
7.100个元素的顺序表,二分查找快还是顺序查找快
8.查看本机连接的方式
9.不稳定的排序有什么
10.智商题,不会
11.循环队列
12.sql语句
13.指令集
14.临界资源访问
15.sql
16.智力题,gg
17.DNS用了什么协议
18.索引
19.DRAM ,SRAM这是什么??
20.200年到2009年底总共多少天

编程题:
1.顺时针回形打印数组,输出String
不知道为什么就是死活66.7%

public static void spiralOrder(int[][] matrix) {

		StringBuffer sb = new StringBuffer();

		if (matrix.length == 0)
			return;
		if(matrix.length==1) sb.append(matrix[0][0]+",");
		int left = 0, right = matrix[0].length - 1, top = 0, bottom = matrix.length - 1, x = 0;
		int[] res = new int[(right + 1) * (bottom + 1)];
		while (true) {
			for (int i = left; i <= right; i++)
				sb.append(matrix[top][i] + ","); // left to right.
			if (++top > bottom)
				break;
			for (int i = top; i <= bottom; i++)
				sb.append(matrix[i][right] + ","); // top to bottom.
			if (left > --right)
				break;
			for (int i = right; i >= left; i--)
				sb.append(matrix[bottom][i] + ","); // right to left.
			if (top > --bottom)
				break;
			for (int i = bottom; i >= top; i--)
				sb.append(matrix[i][left] + ","); // bottom to top.
			if (++left > right)
				break;
		}
		System.out.println(sb.substring(0, sb.length() - 1));

	}

第二道题:
找组合最大数字
输入:
6 0 7
9 0 3
4

输出6 0 7 9,顺序是输入的顺序
不知道为什么就是0.。。。。。

public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		String[] arr1 = sc.nextLine().split(" ");
		String[] arr2 = sc.nextLine().split(" ");
		int k = sc.nextInt();
		if (arr1.length > 0 && arr2.length > 0 && k >= 0) {
			int[] a1 = Arrays.asList(arr1).stream().mapToInt(Integer::parseInt).toArray();
			int[] a2 = Arrays.asList(arr2).stream().mapToInt(Integer::parseInt).toArray();
			int[] re = null;
			re = new int[a1.length + a2.length];
			System.arraycopy(a1, 0, re, 0, a1.length);
			System.arraycopy(a2, 0, re, a1.length, a2.length);

			if (k <= arr1.length + arr2.length) {
				for (int i = 0; i < k; i++) {
					System.out.print(re[i] + " ");
				}
			} else {
				for (int i = 0; i < re.length; i++) {
					System.out.print(re[i] + " ");
				}
			}
		}

	}
  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值