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

微软四面凉经

全局:

2024(7-9月) 码农类General 硕士 全职@微软中国 - 网上海投 - 技术电面 视频面试  | Fail | 在职跳槽

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

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

x
本帖最后由 MeowMoew 于 2025-2-11 13:12 编辑

整理电脑翻到了半年前的面试,发上来求点米
SDE2岗位总共面了四轮,最后的结果是排序掉了,很遗憾没能抱上巨硬大腿

round1
Jump game 2, Greedy, 我用dfs写的,也给过了
followup:如何改进-空间换时间
  1. // https://leetcode.com/problems/jump-game-ii/ ..
  2. // written during interview, can't promise the correctness, just for draft reference
  3. . Waral dи,
  4. var minJump int = math.MaxInt

  5. // Additionally: use map to store calcuated value -> o(n) time complexity
  6. var indexToMinJump = make(map[int]int)
  7. . 1point 3acres
  8. func jump(nums []int) int {
  9.         // // special cases
  10.         // // 1. len = 0  2. len>=1, nums[0] == 0
  11.         // if len(nums) == 0 {
  12.         //         return 0
  13.         // }
  14.         search(nums, 0, 0).1point3acres
  15.         return minJump
  16. }

  17. func search(nums []int, index, count int) {
  18.         // index valid
  19.         if index < 0 || index >= len(nums) {
  20.                 return
  21.         }
  22. .
  23.         // end condition
  24.         if index == len(nums)-1 {
  25.                 if count < minJump {
  26.                         minJump = count.
  27.                 }

  28.                 return
  29.         }

  30.         // jump
  31.         times := nums[index]

  32.         count++
  33.         for i := times; i >= 1; i-- {
  34.                 search(nums, index+i, count)
  35.         }
  36. }
复制代码
round2 主要是聊项目,然后做了个简单的小题,问一共能想出多少种解法,最优解是什么
  1. // https://leetcode.com/problems/sort-colors
  2. // written during interview, can't promise the correctness, just for draft reference. .и

  3. // sort
  4. // [2,0,2,1,1,0] -> [0,0,1,1,2,2]
  5. // Method 1: classify through counting for each number, then appending

  6. func sortColors (nums []int){
  7.         numToCount := make([]int, 3)

  8.         for _, num := range nums {
  9.                 numToCount[num]++
  10.         }.google  и

  11.         index := 0
  12.         for i, v := range numToCount {
  13.                 for j:=0; j<v; j++ {
  14.                         nums[index] = i
  15.                         index++
  16.                 }
  17.         }. check 1point3acres for more.
  18. }. Waral dи,

  19. . Χ
  20. // sort
  21. // [2,0,2,1,1,0] -> [0,0,1,1,2,2]
  22. // Method 2: two pointers, simulating quick sort, each time group one color, need to go through the process two times
  23. . 1point 3 acres
  24. func sortColors (nums []int){
  25.         // input validation ?
  26.         if len(nums) < 2 {
  27.                 return
  28.         }

  29.         // sort ..
  30.         left, right := 0, 1
  31.         pivot := nums[0]
  32.         
  33.         //end condition: right - > end . 1point3acres.com
  34.         for right < len(nums) {
  35.                 for nums[left]==pivot {
    -baidu 1point3acres
  36.                         left++
  37.                 }
  38.         
    .
  39.                 for nums[right] != pivot {
  40.                         right++
  41.                 }
  42.         
  43.                 // switch
  44.                 nums[left], nums[right] = nums[right], nums[left].1point3acres
  45.         }. .и

  46.         // iteration times control? 3->2
  47.         sortColors(nums[left:]). Χ
  48. }

  49. // Method 3: iterate with two pointers, left:=0, right := len(nums), then iterate, if nums[i] == 0, switch with left, if nunms[i] == 2, switch with right
复制代码
您好!
本帖隐藏的内容需要积分高于 130 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 130 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Popular Interview Questions from Top Companies

一周后收到thank u

评分

参与人数 3大米 +3 收起 理由
抬手就是扣 + 1 给你点个赞!
attt + 1 欢迎分享你知道的情况,会给更多积分奖励!
微信用户_a69bb13 + 1 给你点个赞!

查看全部评分


上一篇:阿里面经 - Base 杭州
下一篇:[求加米] 亚麻中国地区 SWE Intern OA + 时间线✅
推荐
 楼主| MeowMoew 2025-2-12 10:13:30 来自APP | 只看该作者
全局:
微信用户_a69bb13 发表于 2025-02-11 13:50:17
lz给你加米了!请问你这几轮的题都打出来了,那你知道为什么挂了吗?谢谢啦
跟帖子说的一样排序排掉了,前面有更优秀的接了offer
回复

使用道具 举报

地里匿名用户
推荐
匿名用户-SU6IV  2025-2-12 01:42:16
😂 2
软那么恶心 没什么好可惜的
回复

使用道具 举报

全局:
lz给你加米了!请问你这几轮的题都打出来了,那你知道为什么挂了吗?谢谢啦
回复

使用道具 举报

🔗
caiB 2025-2-28 10:06:06 来自APP | 只看该作者
全局:
这么难么? 最近面了两轮coding,两个面试官都当场反馈很好。
已经第三天了,还没有hr联系,也是国内。. 1point3acres.com
请问下楼主timeline
回复

使用道具 举报

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

本版积分规则

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