亞馬遜 2021 技術崗面試題
小編:管理員 743閱讀 2021.10.10
A standard 52-card deck, which contains 2, 3, …, J, Q, K, A. Pick four cards from the deck as a hand. Provide a function to figure out who is the winner of given two hands.
There are different types:
T1. Any four cards of the same rank. In this type, the bigger card decides who wins.
For example: 3,3,3,3< 6,6,6,6
第2題:
T2. Any string with all four cards, and in such case (consecutive), ‘A’ can count as either a high or a low card. Otherwise, A is a highest card. In this type, the highest card decides who wins.
For example: A,2,3,4< J,Q,K,A
第3題:
T3. Any three cards of the same rank, In this type, the higher three same cards wins.
For example: 3,3,3,2> 2,2,2,A
第4題:
T4. Any two cards of the same rank together with another two cards of the same rank. In this type, if two hands share same higher Pair, the bigger another Pair decides who wins. Otherwise, bigger Pair wins.
For example: 3,3,4,4> 4,2,4,2
第5題:
T5. Any two cards of the same rank. In this type, bigger Pair wins. If two hands share same Pair, the bigger Third decides who wins. Otherwise, the bigger Fourth wins.
For example: 3,3,7,4< 3,3,7,5
第6題:
T6. Any hand not in the above-mentioned hands. In this type, the highest card decides who wins.
For example: A,K,Q,9< 10,Q,A,K
We don’t take the suit into consideration. If two hands in different type, the rule is: T1>T2>T3>T4>T5>T6
You will get two lines as input:
6,3,4,5
3,4,5,6
You should output the result:
0
If the first two line is bigger than the second line, the result should be 1. If the first line is smaller than the second line, the result should be -1. If they are equal, you should return 0.
If a participator cheats in this game, the number of the same card will be more than four in the two hands. In this case, you should return -2.
Symmetric number is a kind of non-negative number which looks the same as its inversion. For example, ”12321”is a symmetric number. Given any number n represented by a string, find the next symmetric number which is bigger than n.
Here are two examples,
Sample 1:
Input:
123
Output:
131
Sample 2:
Input:
12321
Output:
12421
第7題:
Common Ancestor(Programming)
Question:
A endless Complete Trinary Tree. Node ID is its back-and-forth order in level travel. Find the closest common ancestor.
(“Complete Trinary” means each node has three children, neither more or less)
Example:
The node 13 and 15 have a closest common parent12
The node 16 and 10 have a closest common parent 1
If one Node is the ancestor of the another one, that Node is the closest common ancestor.
Input:
You will get two Nodes’ ID like:
13 9
Output:
You should return the closest common parent node ID like:
0
相關推薦
- 烽火 2021 技術面試題 第1題:iso七層協議,以及每次有哪些協議。第2題:兩個ip地址為192.168.0.1/23和192.168.1.1/23 能不能互相通信。如果不能說明為什么,應該怎么修改,才能互相通信 第3題:ATM,FPGA,TCP/IP,FIFO,FSM解釋 第4題:FPGA CPLD結構 第5題:FPGA開發過程和工具 第6題…
- 亞馬遜 2021 技術類面試題 第1題:對于一個給定的物品名稱X以及顧客的購物清單數組,找出所有購買過X的客戶中所買的其他的最多的商品種類。如已知購物數組為 [CustA,Item1, CustB,Item2, CustC,Item1, CustA,Item2, CustD,Item3, CustB,Item1] 給定物品名稱為Item1時就應該返回Item2。用…
- 2021年蜂鳥眾包回爐考試題大全,附上答案 想做蜂鳥眾包外賣員的朋友,在入職之前一定有面臨著這樣的問題,那就是面試官叫你考試。而在掃描之后,面對眾包回爐考試的題目時,你可能會頓時蒙圈,也許考了幾天了,就是過不了。為此,小編為你送上2021年眾包回爐考試大全25道題以及真實答案,以下就是:湛江…