Package ship

题意大约是Amazon在做一个package shipment的system, 然后会input里会有两种指令,["INSERT", "UIAHSIHGFG"] 和 ["SHIP", "-"]. ["INSERT", "UIAHSIHGFG"] : 代表要往系统里面存放一个新的package id ["SHIP", "-"] : 代表要求系统把input进系统里的package id给ship出去 限制条件是必须在系统里面有三个或以上package id的时候,收到["SHIP", "-"] 时才能把存下来的 package ID ship出去,否则就输出 “N/A”. ship输出的顺序要跟输入的顺序一样 Input example: [["INSERT", "UIAHSIHGFG"] , ["INSERT", "RGSRTWR"] , ["SHIP", "-"] , ["INSERT", "EYJTRJYEYTJ"] , ["INSERT", "QERGFSFDS"], ["SHIP", "-"] ] Output example: [[N/A], [UIAHSIHGFG, RGSRTWR, EYJTRJYEYTJ]] Java的function大概是这样的: public static List<List> shipPackage(List<List> query) { ... }

Last updated