新人求大米。第一次发帖蟹蟹٩('ω')و。
疫情前17/18年的时候就开始用过Hopper的app订机票,用户体验很不错.我是通过猎头联系申请的这个SDE职位. 是HOTEL部门的head count. 永久REMOTE.
第一轮就是和HR聊天. 讨论一下你的背景. 介绍介绍公司的业务. 介绍介绍公司技术层面有很多的FLAG高层的大佬们. 讲了他们有很多Scala的开源大佬等等. 待遇可以媲美FLAG.但是技术要求也相对较高.
第二轮是一个4小时的OA. 按照用户所选择的对话,来打印出和AI的对话。一共7个Test Case。 我一开始写对了1,2,3。但是最终写4的时候3又错了。交的时候就变成1,2,4。 没想到被告知有下一轮电您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 使用VIP即刻解锁阅读权限或查看其他获取积分的方式 游客,您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 VIP即刻解锁阅读权限 或 查看其他获取积分的方式 教我一下蟹蟹。)- Ticket{
- String id
- String floor
- }
- public Ticket enter(){
- }
- public void exit(){
- }
复制代码 以下为OA的代码。Input和Output。- package hopper;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.OptionalInt;
- interface InputObject {
- String getText();
- OptionalInt getLabel();
- }
- class Output implements InputObject {
- private final String text;
- private final OptionalInt label;
- public Output(String text) {
- this.text = text;
- this.label = OptionalInt.empty();
- }
- public Output(String text, int label) {
- this.text = text;
- this.label = OptionalInt.of(label);
- }
- public String toString() {
- return String.format("Output(text='%s', label=%d)", this.text, this.label);
- }
- public String getText() {
- return this.text;
- }
- public OptionalInt getLabel() {
- return this.label;
- }
- }
- class Answer implements InputObject {
- private final String text;
- public Answer(String text) {
- this.text = text;
- }
- public String toString() {
- return String.format("Answer(text='%s')", this.text);
- }
- public String getText() {
- return this.text;
- }
- public OptionalInt getLabel() {
- throw new UnsupportedOperationException();
- }
- }
- class Conclusion implements InputObject {
- private final String text;
- public Conclusion(String text) {
- this.text = text;
- }
- public String toString() {
- return String.format("Conclusion(text='%s')", this.text);
- }
- public String getText() {
- return this.text;
- }
- public OptionalInt getLabel() {
- throw new UnsupportedOperationException();
- }
- }
- class Goto implements InputObject {
- private final int label;
- public Goto(int label) {
- this.label = label;
- }
- public String toString() {
- return String.format("Goto(label=%d)", this.label);
- }
- public String getText() {
- throw new UnsupportedOperationException();
- }
- public OptionalInt getLabel() {
- return OptionalInt.of(this.label);
- }
- }
- class IndentationAndInputObject {
- private final int indentation;
- private final InputObject inputObject;
- public IndentationAndInputObject(int indentation, InputObject inputObject) {
- this.indentation = indentation;
- this.inputObject = inputObject;
- }
- public String toString() {
- return String.format("IndentationAndInputObject(indentation=%d, inputObject=%s)", this.indentation, this.inputObject);
- }
- public int getIndentation() {
- return this.indentation;
- }
- public InputObject getInputObject() {
- return this.inputObject;
- }
- }
- public class Solution {
- public static final String HOPPER_MESSAGE_PREFIX = "Hopper: ";
- public static final String USER_MESSAGE_PREFIX = "User: ";
- public static final String CONCLUSION_MESSAGE_PREFIX = "Conclusion: ";
- public void printConversation(List<IndentationAndInputObject> flatTree, List<String> userAnswers) {
- // Write your solution below
- // Some example code is provided to show you how to access our data structures, feel free to modify/delete
- for (IndentationAndInputObject iaio : flatTree) {
- if (iaio.getInputObject() instanceof Output) {
- System.out.println(HOPPER_MESSAGE_PREFIX + iaio.getInputObject().getText());
- } else if (iaio.getInputObject() instanceof Answer) {
- System.out.println(USER_MESSAGE_PREFIX + iaio.getInputObject().getText());
- } else if (iaio.getInputObject() instanceof Conclusion) {
- System.out.println(CONCLUSION_MESSAGE_PREFIX + iaio.getInputObject().getText());
- }
- }
- }
- public IndentationAndInputObject parseLine(String line) {
- int indentation = line.indexOf(line.trim());
- return new IndentationAndInputObject(indentation, parseInputObject(line.substring(indentation)));
- }
- public InputObject parseInputObject(String line) {
- if (line.charAt(0) == '-') {
- return new Answer(line.substring(1));
- } else if (line.charAt(0) == '=') {
- return new Conclusion(line.substring(1));
- } else if (line.charAt(0) == '>') {
- return new Goto(Integer.parseInt(line.substring(1)));
- } else {
- return parseOutput(line);
- }
- }
- public Output parseOutput(String line) {
- boolean labelFound = false;
- int labelDelimiter = -1;
- for (int i = 0; i < line.length(); i++) {
- if (!Character.isDigit(line.charAt(i))) {
- if (line.charAt(i) == ':') {
- labelFound = true;
- labelDelimiter = i;
- }
- break;
- }
- }
- if (labelFound) {
- return new Output(line.substring(labelDelimiter + 1), Integer.parseInt(line.substring(0, labelDelimiter)));
- } else {
- return new Output(line);
- }
- }
- public static void main(String args[]) throws Exception {
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
- Solution solution = new Solution();
- String line;
- boolean processingExamples = false;
- List<String> userAnswers = new ArrayList<>();
- List<IndentationAndInputObject> flatTree = new ArrayList<>();
- while ((line = reader.readLine()) != null) {
- if (line.equals("---")) {
- processingExamples = true;
- } else if (processingExamples) {
- userAnswers.add(line);
- } else {
- flatTree.add(solution.parseLine(line));
- }
- }
- solution.printConversation(flatTree, userAnswers);
- }
- }
- }
复制代码- Hello, John! It looks like you booked a Basic Economy flight.
- Are you aware that this flight doesn't have any storage for carry-on luggage?
- -No
- Some other limitations you may want to consider is that you will not be able to pick a seat.
- We're happy to let you know that we can upgrade you today for just $25!
- Would you like to do that now?
- -Not right now
- =Okay, please let our customer service team know if you change your mind.
- -Yes, please upgrade
- =Okay, you've been upgraded!
- -Yes
- We're happy to let you know that we can upgrade you today for just $25!
- Would you like to do that now?
- -Not right now
- =Okay, please let our customer service team know if you change your mind.
- -Yes, please upgrade
- =Okay, you've been upgraded!
- ---
- No
- Not right now
复制代码- Hopper: Hello, John! It looks like you booked a Basic Economy flight.
- Hopper: Are you aware that this flight doesn't have any storage for carry-on luggage?
- User: No
- Hopper: Some other limitations you may want to consider is that you will not be able to pick a seat.
- Hopper: We're happy to let you know that we can upgrade you today for just $25!
- Hopper: Would you like to do that now?
- User: Not right now
- Conclusion: Okay, please let our customer service team know if you change your mind.
复制代码 |