- Gifting Groups
To-do:
- Beta Testing
- Shopping Patterns -> graph
- Optimizing Box Weights/Amazon Fulfillment Builder
- Largest Item Association
- LRU Count Cache misses
- Two sum unique pair (two pointers + sort)
Completed:
-
Amazon Music Pairs/Pairs of Songs With Total Durations Divisible by 60
-
Top K Frequently Mentioned Keywords (Priority Queue/Minheap + hash_map)
-
Top K Frequently elements (Priority Queue/Minheap + hash_map)
Amazon Interview:
Round1: LP, DS/ALGO coding problem. [LC medium] Round2: LP, 2 DS/ALGO coding problem [LC medium] Round3: All LP, Domain experience Round4: Embedded Design Round5: LP, DS/ALGO coding problem [LC medium] Round6: LP, and work experience, embedded systems
DFS BFS Sliding Window Tree LinkedList.
[Prime Air Route] Amazon Fresh Promotion Optimal Utilization [earliest time to complete delivery] [two sum pairs] [word break II] [Merge K sorted list]
总结一下截止到现在社招 OA 题库: 具体的题地里很多了 大家稍找一下就有了
- 卡车装M个箱子, N个地点List M<N 列出最近的M个位置。 要注意输入不正常的情况,比如只有一个输入 http://www.1point3acres.com/bbs/thread-289277-1-1.html
- 给个无序数组要构建BST , 然后找出Node1 Node2 距离 我觉得这道题要好好准备一下,我准备了好久看地理有大佬testcase 没过瑟瑟发抖中 http://www.1point3acres.com/bbs/thread-192414-1-1.html
- 棒球题目 stack 解决。这个要注意细节反正我花了好久才理解题目的意思 http://www.1point3acres.com/bbs/thread-270278-1-1.html
- 高尔夫场砍树问题。 PQ + BFS ( LC The Maze II) http://www.1point3acres.com/bbs/thread-288738-1-1.html
- common manager 问题 nnary-lca http://www.1point3acres.com/bbs/thread-288537-1-1.html
- 找所有anagram http://www.1point3acres.com/bbs/thread-288537-1-1.html
- 水果清单 就是水果清单上的必须按顺序输出在shoppingcart里面 http://www.1point3acres.com/bbs/thread-288738-1-1.html
- valid Parentheses LC 原题 stack 解
- 给个Movie movie BFS 找出所有关联电影中top K rate 的电影 Set 这道题我找了好久没有找到比较好的类题,大家将就准备 http://w
- 菜单就是给一个人名list 然后菜单国家的list,要求人名对应到国家再对应到菜品。 我的做法是建两个hashmap http://www.1point3acres.com/bbs/thread-280797-1-1.html
- 最大互联点数集合 itemAssociation http://www.1point3acres.com/bbs/thread-280797-1-1.html http://www.1point3acres.com/bbs/thread-281940-1-1.html
- golf球场修场地。 这个是老题 大家搜一搜就好
- maze 题目最近很常考 就是给一个maze,0 不能走, 1可以走,走到9 问最小步数。 我的做法是用用bfs + terminate condition 具体题目链接在这里https://www.1point3acres.com/bbs ... 6orderby%3Ddateline
- anagram 问题leetcode原题
- k distinct subtring 这个我开始试着用了很多的方法,都输出不对,因为输出长度也是k, 后来用了slidingwindow 然后checks
- 飞机里程或者capacity 最近, 就是给了两个list 对应编号, 让求出各拿出一个元素的和最接近一个值 我觉得这道题可以用bfs+ priority queue来做,但是没有动手做,地理有大佬建树做的,太大佬了, 我不是很建议用two pointer, 因为two pointers 要来来回回的走, 来加上重复的历程, 我用的bf做的。 具体题目看这个https://1o24bbs.com/t/topic/3374
Prime Air Route 2020 Experienced HackerRank USA Amazon Fulfillment Builder 2020 Experienced HackerRank USA Amazon Fresh Promotion 2020 Experienced SHL/HackerRank USA Amazon Music Pairs 2020 Experienced HackerRank USA/India Items in Containers 2020 Experienced SHL/HackerRank USA Largest Item Association 2020 Experienced SHL USA Turnstile 2020 Experienced SHL/HackerRank USA Five Star Sellers 2020 Experienced HackerRank USA/Canada Beta Testing 2020 Experienced HackerRank USA/Canada Utilization Checks 2020 Experienced HackerRank USA/India Top K Frequently Mentioned Keywords 2020 Experienced SHL USA Transaction Logs 2020 Experienced HackerRank USA Substrings of Size K with K-1 Distinct Chars 2020 Experienced SHL/HackerRank USA Number of Islands 2020 Experienced SHL/HackerRank USA Most Common Word 2020 Experienced SHL/HackerRank USA Rover Control 2020 Experienced HackerRank USA Distance Between Nodes in BST 2020 Experienced SHL USA/UK Robotics Challenge 2020 Experienced SHL USA/UK K Closest Points to Origin 2020 Experienced SHL USA Shopping Patterns 2020 Experienced SHL/HackerRank USA/India
#include <limits.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
typedef enum { SUCCESS, /* If the command is successfully parsed / NULL_PARAM, / If any pointer in the input is NULL / INVALID_UNDO_CMD / If the requested undo command is not valid */ } FuncStatus_t;
typedef enum { FWD, /* +Y / BCK, / -Y / RGT, / +X / LFT, / -X / UND / Undo */ } CommandType_t;
typedef struct { CommandType_t cmd_type; int32_t value; } Command_t;
#include <unordered_map>
FuncStatus_t ParseCommands(const Command_t cmds[], const uint32_t num_cmds, int32_t * out_x, int32_t * out_y) { /* Warning: You can use stdout for debugging, but doing so will cause the test cases to fail. */ int px{}, py{}, lx{}, ly{}; Command_t lc{};
if (out_x == nullptr || out_y == nullptr || cmds == nullptr)
return NULL_PARAM;
for (int i = 0; i < num_cmds; i++) {
int val = cmds[i].value;
switch(cmds[i].cmd_type) {
case FWD:
py += val;
lx = 0;
ly = val;
break;
case BCK:
py -= val;
lx = 0;
ly = -val;
break;
case RGT:
px += val;
lx = val;
ly = 0;
break;
case LFT:
px -= val;
lx = -val;
ly = 0;
break;
case UND:
if (i == 0) return INVALID_UNDO_CMD;
if (val != 1) return INVALID_UNDO_CMD;
if (i > 0 && cmds[i-1].cmd_type == UND) return INVALID_UNDO_CMD;
px -= lx;
py -= ly;
break;
}
}
*out_x = px;
*out_y = py;
return SUCCESS;
}
#include <limits.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <inttypes.h> #include <stdbool.h>
typedef enum { STATUS_SUCCESS, STATUS_BAD_POINTER, STATUS_BAD_ARRAY_LENGTH, STATUS_NO_SENSOR_DATA, } FuncStatus_t;
#include #include <stdint.h>
using namespace std;
int countBits(uint8_t val) { int count{};
while(val) {
count ++;
val &= (val - 1);
}
return count;
}
size_t MSB(uint8_t val) { size_t res{};
while (val) {
res++;
val >>= 1;
}
return res;
}
FuncStatus_t TransformData( const size_t inputDataLength, const uint8_t inputDataValues[], const size_t outputDataLength, uint8_t outputDataValues[]) {
if (inputDataValues == nullptr || outputDataValues == nullptr)
return STATUS_BAD_POINTER;
int numS = countBits(inputDataValues[0]);
if (numS == 0)
return STATUS_NO_SENSOR_DATA;
size_t msb = MSB(inputDataValues[0]);
if (inputDataLength < 1+msb || outputDataLength < 1+(msb*4))
return STATUS_BAD_ARRAY_LENGTH;
int shift = 0;
uint8_t input_mk = inputDataValues[0];
outputDataValues[0] = numS;
uint32_t *o_data = (uint32_t*) &outputDataValues[1];
while (shift < 8) {
if(input_mk & (1 << shift)) {
uint8_t s_data = inputDataValues[shift+1];
*(o_data + shift) = (uint32_t) s_data * (1 << (shift));
}
shift ++;
}
return STATUS_SUCCESS;
}