亚麻OA2新鲜面经

今晚刚刚做了OA2
第一题最喜欢的book那道题,要注意book如果没有所属的类别的情况,不然会跟我一样一开始runtime error;
第二题。。Critical Links,都说最近没有这个题了,还是被我抽到了,要注意起始序号是1,然后图为空返回空,还要最后的返回结果是排好序的就可以过所有的test case,我是按照之前搜集的面经和leetcode写好了,这题没有面经真的难。

Amazon wants to pilot hardware replacements in Data Center AMZN525 to increase the reliability of their network. AMZN525 has a ‘connected’ network of data servers i.e. every server can communicate with the rest of their network of data servers, i.e. every server can communicate with the rest of the network. The data servers are connected by point to point cables to establish critical or non critical conncections. A connection is considered critical if its removal results in a disconnected network of servers. Amazon wants to significantly increase the reliability of its data center by replacing the critical connections with far more reliable cables.
Write a method that returns critical connections in AMZN525

Input:-
Has 3 arguments:-
numOfServers:- an integer representing the number of server in data centers
numOfConnections:-an integer representing the number of connections between the servers
connections:- a list of pairs of integers representing the connections between 2 servers

Output:-
Return a list of iteger pairs representing the critical connections. Output an empty list of there are no critical connections

Constraints:-
0<=numServers<=100,000
0<=numOfConnections<=100,000
1<=connections[i][j]<=numof servers
0<=i<numOfConnections
o<=j<2

It is based on Bridge in a graph problem on geek for GEeks

ONLY 11/14 TEST CASES PASSED FOR ME, WHAT ALL BASE CONDITIONS/CORNER CASES I MIGHT BE MISSING?

报一个新题

OA1就是7个debug题,

都很简单,⼤概30分钟就做完了

bug的出现形式⼤概就昰:

循环括号加错位置

⼤于号⼩于号写反了

具体哪个参数应该加1或者减1

等等

OA4,70分钟,2个编程题

笭⼀题 在⼀个⾏列都排序好的数组⾥找指定target

⾏是排序好的,列是排序好的,但是下⼀⾏的第一个元素不⼀定⼤于上⼀⾏最后⼀个元素

第⼆题 求⽆向图删除哪个连接后就不全连通了

我直接循环删除每⼀个连接,然后随便找个点在删除后的图⾥bfs,得出的点集数量变少了就放到结枝⾥

You are given an array A of size N. Your task is to select any number X and perform " bitwise XOR " of all the numbers with X. Your task is to select X in such a way that after performing the XOR operation ,the sum of the arry is maximized . print the number X that you must select to maximize the sum of the array. If multple X gives the same maximum sum, then print the minimum sum X.

constarints:
1<=N<=10^4
1<=Ai<=10^18
0<=X<2^63

sample Input:
N = 5
A[] = {10,12,5,7,19}

Output:
9223372036854775800