📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
查看: 5169| 回复: 12
跳转到指定楼层
上一主题 下一主题
收起左侧

[找工就业] Uber 24ng oa

 
全局:

2023(4-6月)-CS硕士+fresh grad 无实习或全职 | 网上海投| 码农类General全职@Uber

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
..
70 min,4个题,一个essay,二个medium,一个目测是hard

  • time calculation,给一个数组,根据条件返回结果,条件(a < b):
    time[a] == time[b] , result += 0

    time[a] > time[b] result += 2
    time[a] < time[b] result += 1
. 1point3acres    这个很简单,就是写一个prev,储存前一个time就行,然后分情
  • 文件系统,有switch和push两种操作:switch 到不同的branch,push 一些文件到这个branch。然后返回文件最大的branch。同时一个branch里面只能有不同的文件,不能有相同的。

     example:
         "switch branch1"
         "push file1"
         "push file2". .и
         "push file1"
         "switch branch2"
         "push file1"
         "push file2"
         "push file3"
    return branch2

思路也很简单,建一个Map<String, Set<String>> map = new HashMap<>(). set的大小就是所含文件数量大小,返回最大就行,可以maxheap这样

  • for an interval like this: int[][][] schedules = { {{5, 6}, {1, 2}, {3, 4}}, {{7, 8}, {5, 6}, {6, 7}}, {{2, 3}, {0, 1}, {4, 5}} }; each employer has their schedule. we want to find the earliest time that every one is free to hold a meeting with length k public int meeting(int[][][] schedule, int k){}
. Χ


    类似merge interval和meeting room 2。思路就是先merge all interval,然后在看中间的空闲时间是否够
. .и
  • 这个没做出来,暴力求解超时。for a list a string, find all pairs that words[I] is words[j] suffix or words[j] is words[i] suffix

    感觉可以建一个树,根结点就是相同字母,prefix这样。

ng已经挂了很多面试了,求米看面经,准备面试上岸🙏🙏

评分

参与人数 14大米 +14 收起 理由
gogostudy + 1 赞一个
微信用户_c6433f8 + 1 很有用的信息!
elsa + 1 很有用的信息!
liur + 1 欢迎分享你知道的情况,会给更多积分奖励!
沱沱水大咸鱼 + 1 赞一个

查看全部评分


上一篇:关于Meta内推的疑问
下一篇:求美东 MLE 面试的 mock 搭子
推荐
moran_li 2024-6-29 22:29:30 | 只看该作者
全局:
q4
散岭死伞
toString and trie
回复

使用道具 举报

推荐
 楼主| 大聪明gyq 2024-6-29 11:16:09 | 只看该作者
全局:
liur 发表于 2024-6-28 22:50
我也拿到了一样的第四题,我的做法是prefix tree顺序一遍倒序一遍然后减去多数的一样的str。我觉得有更好的 ...

sorry,我刚看到。我问了问ChatGPT,大概这样:
import java.util.HashMap;
import java.util.Map;

public class SuffixPairChecker {.google  и

    // Trie Node class
    static class TrieNode {
        Map<Character, TrieNode> children = new HashMap<>(); ..
        boolean isEndOfWord = false;
    }

    // Trie class
    static class Trie {
        TrieNode root = new TrieNode();

        // Insert a word in reverse order.1point3acres
        public void insert(String word) {
            TrieNode node = root;
            for (int i = word.length() - 1; i >= 0; i--) {
                char c = word.charAt(i);
                node = node.children.computeIfAbsent(c, k -> new TrieNode());
            }
            node.isEndOfWord = true;
        }
..
        // Search for a suffix in the trie. 1point3acres.com
        public boolean searchSuffix(String word) {
            TrieNode node = root;
            for (int i = word.length() - 1; i >= 0; i--) {. Waral dи,
                char c = word.charAt(i);
                if (!node.children.containsKey(c)) {
                    return false;
                }
                node = node.children.get(c);
                if (node.isEndOfWord) {.
                    return true;
                }
            }
            return node.isEndOfWord;
        }
    }

    public int pairCheck(String[] words) {. Χ
        Trie trie = new Trie();
. Waral dи,        int count = 0;
. 1point 3 acres
        // Insert all words into the trie in reversed order
        for (String word : words) {
            trie.insert(word);.google  и
        }

        // Check each word against the trie for suffix match
        for (String word : words) {.google  и
            // Remove the word from the trie to avoid counting itself
            if (trie.searchSuffix(word)) {
                count++;.
            }
        }
..
        return count;
    }

    public static void main(String[] args) {.1point3acres
        SuffixPairChecker checker = new SuffixPairChecker();
        String[] words = {"apple", "ple", "banana", "na", "an"};
        int result = checker.pairCheck(words);
        System.out.println("Number of valid suffix pairs: " + result); // Expected output
    }
}
回复

使用道具 举报

推荐
风妖精 2024-6-28 14:38:06 | 只看该作者
全局:
最后一题如果咱没理解错的话?后缀反过来就是前缀,然后前缀树求解。每个trie树上节点额外维护2个set,一个是当前哪些字符串经过了这个节点,一个是哪些字符串在这个节点终止。然后插入新字符串的话,如果经过一个节点,则在这个节点终止的所有串都是这个新字符串的前缀。走到终止节点的时候,则这个字符串是所有经过这个节点字符串的前缀。然后将所有字符串依次插入更新答案即可。
回复

使用道具 举报

🔗
Don_ 2024-6-28 11:03:58 来自APP | 只看该作者
全局:
请问一般对多少个例子才能过
回复

使用道具 举报

全局:
我听说今年oa要分享屏幕?
回复

使用道具 举报

全局:
风妖精 发表于 2024-06-27 23:38:06
最后一题如果咱没理解错的话?后缀反过来就是前缀,然后前缀树求解。每个trie树上节点额外维护2个set,一个是当前哪些字符串经过了这个节点,一个是哪些字符串在这
請問這題原題大概在問什麼呢
回复

使用道具 举报

🔗
 楼主| 大聪明gyq 2024-6-28 20:20:40 | 只看该作者
全局:
风妖精 发表于 2024-6-28 02:38
最后一题如果咱没理解错的话?后缀反过来就是前缀,然后前缀树求解。每个trie树上节点额外维护2个set,一个 ...
. 1point3acres
这个我不太确定。。。。说实话因为有点超出能力范围了。但感觉不太对,不过可以写伪代码一起讨论一下。
.google  и
ps: 如果prefix反过来是后缀的话,建树可能没有意义,个人觉得,可能是在树里面加一个new attribute???不太确定
回复

使用道具 举报

全局:
你是啥时候毕业啊
回复

使用道具 举报

🔗
liur 2024-6-29 06:40:42 | 只看该作者
全局:
求问一下具体第4题的题目l i j什么要求呢?有点没看懂题目
可以给个example case 吗
回复

使用道具 举报

🔗
liur 2024-6-29 10:50:24 | 只看该作者
全局:
我也拿到了一样的第四题,我的做法是prefix tree顺序一遍倒序一遍然后减去多数的一样的str。我觉得有更好的方法不需要遍历两遍的但是我没管就交了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表