📣 黑五网一特惠|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 10
跳转到指定楼层
上一主题 下一主题
收起左侧

高盛 2025 sde OA 大合集10题 附答案

全局:

2025(7-9月) 工程类 硕士 实习@Goldman Sachs - 内推 - 其他  | 😃 Positive 🙂 Easy | Pass | 应届毕业生

z准备时把全网的例题都找了,并做了记录和代码,供分享,求加米。需要原稿课私信。
  • /*
    public static int alphanumbericCombination(String s) {
        int n = s.length();
        int[] dp = new int[s.length() + 1];
        dp[1] = 1;
        if (s.length() == 1) return 1;
        int twoDigits = Integer.parseInt(s.substring(0, 2));
        if (twoDigits >= 10 && twoDigits <= 26) {
            dp[2] = 2;
        } else {
            dp[2] = 1;
        }
        for (int i = 3; i < n + 1 ; i++) {
            int oneDigit = Integer.parseInt(s.substring(i - 1, i));
            if ( oneDigit <= 9 && oneDigit >= 1) {
                dp += dp[i - 1];
            }
            twoDigits = Integer.[i]parseInt
    (s.substring(i - 2, i));
            if ( twoDigits <= 26 && twoDigits >= 10) {
                dp += dp[i - 2];
            }
        }
        return dp[n];
    }
  • [i]/**
    A compliance system monitors incoming and outbound calls.
    It sends an alert whenever the average number of calls over a trailing number of minutes exceeds a threshold. If the number
    of trailing minutes to consider, precedingMinutes = 5, at time T, average the call volumes for times T-(5-1), T-(5-2) ...T-(5-5).
    Example
    n = 8
    numCalls = [2, 2, 2, 2, 5, 5, 5, 8]
    alertThreshold = 4
    precedingMinutes = 3
    No alerts are sent until at least T = 3 because there are not enough values to consider. When T = 3, the average calls = (2 + 2 + 2)/3 = 2.
    Average calls from T = 4 to T = 8 are 2, 3, 4, 5, and 6. A total of two alerts are sent during the last two periods.
    */
    public static int calculateAlert(int[] numCalls, int alertThreshold, int precedingTime) {
        int count = 0;
        int sum = 0;
        for (int i = 0; i < precedingTime && i < numCalls.length; i++) {
            sum += numCalls;
            double average = (double) sum / precedingTime;
            if (average > alertThreshold) {
                count++;
            }
        }
        for (int i = precedingTime; i < numCalls.length; i++) {

            sum -= numCalls[i - precedingTime] ;
            sum += numCalls[i];
            System.[i]out
    .println(" sum: " + sum);
            double average = (double) sum / precedingTime;
            System.out.println("avarage: " + average);
            if (average > alertThreshold) {
                count++;
            }
        }
        return count;
    }
  • /**
    * calculate chair base on the orders
    您好!
    本帖隐藏的内容需要积分高于 188 才可浏览
    您当前积分为 0。
    使用VIP即刻解锁阅读权限或查看其他获取积分的方式
    游客,您好!
    本帖隐藏的内容需要积分高于 188 才可浏览
    您当前积分为 0。
    VIP即刻解锁阅读权限 或 查看其他获取积分的方式
    Unlock interview details and practice with AI
    Popular Interview Questions from Top Companies
    st<List<String>> list) {
        String[][] res = new String[list.size()][];
        for (int i = 0;i < list.size(); i++) {
            res = new String[list.get(i).size()];
            for (int j = 0; j < res[i].length; j++){
                res[i][j] = list.get(i).get(j);
            }
        }
        return res;
    }

  • [i]/**

    * calculate number of unique pairs in the given nums with a difference of k, k can be 0;
    */
    public static int countPair(int[] numbers, int k) {

        Set<Integer> set = new HashSet<>();
        for (int num : numbers) {
            set.add(num);
        }
        Set<String> uniqueSet = new HashSet<>();
        for (int num : numbers) {
            if (set.contains(num + k)) {
               uniqueSet.add(num + ", " + num + k);
            }
        }
        return uniqueSet.size();
    }

  • /**
    *li kou: liu si qi:  Palindromic Substrings
    */
    public int palindromeCount(String s) {
        int n = s.length();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int even = count(s, i, i + 1);
            int odd = count(s, i, i);
            ans += even + odd;
        }
        return ans;
    }
    public int count(String s, int left, int right){
        int count = 0;
        while (left >= 0 && right < s.length() && s.charAt(left) == s.charAt(right)) {
            left--;
            right++;
            count++;
        }
        return count;
    }

本帖子中包含更多资源

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

x

评分

参与人数 15大米 +30 收起 理由
微信用户_d99415a + 1 很有用的信息!
微信用户_um5kl + 1 赞一个
凱yeah + 1 很有用的信息!
kylekn0wkn0w + 1 给你点个赞!
吟风 + 1 欢迎分享你知道的情况,会给更多积分奖励!

查看全部评分


上一篇:Meta MLE E4 面经
下一篇:DataDog新鲜出炉的VO
🔗
girlinseattle 2024-10-29 09:05:25 | 只看该作者
全局:
感谢楼主,请问可以私信发一下合集吗?给你发了不知道你能不能看到
回复

使用道具 举报

🔗
 楼主| Long317li6262 2024-10-30 10:58:49 来自APP | 只看该作者
全局:
girlinseattle 发表于 2024-10-28 18:05:25
感谢楼主,请问可以私信发一下合集吗?给你发了不知道你能不能看到
你发我私信或者留个邮箱
回复

使用道具 举报

🔗
mika_baka 2024-11-4 01:59:42 | 只看该作者
全局:
好全啊,感谢楼主
回复

使用道具 举报

全局:
xzhyqq866
艾特163
dot

com
求合集!
回复

使用道具 举报

全局:
今日加米上限了,明天加!
回复

使用道具 举报

全局:
hi 楼主可以发个联系方式嘛 看不到题目
edgarll 艾特 163 点 com
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-HLNXV  2024-11-5 00:52:28
求一个合集,非常感谢!duo737459 艾特 gmail com
回复

使用道具 举报

🔗
JamesX125 2024-11-21 14:27:40 | 只看该作者
全局:
您好!楼主~已加米!能求一个分享嘛
zhchen727 艾特 gmail com
超级感谢!!
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-VEOJ0  2024-11-24 08:59:29 来自APP
已加米,求分享!alinajw146艾特哦gmail点com 感谢!
回复

使用道具 举报

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

本版积分规则

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