字节跳动一面[这是一篇凉经]

写在前面

那个老哥堆MLSYS感兴趣(ML + SYS,秀我一脸)
这公司实在的很,就是撸算法题。先说思路,思路不是他想要的,没有看你写代码的欲望

NameNode 和 SecondaryNameNode

SecondaryNameNode有两个作用,一是镜像备份,二是日志与镜像的定期合并。两个过程同时进行,称为checkpoint(检查点)。

https://blog.csdn.net/qq_39521554/article/details/80721781

补充HA(High Availabilaty)

先放这里吧

负载性能预测中你的地址这个属性是怎么用的?

如何体现出局部性的?

随机森林基本原理。如何抽样的。

归一化的常见方法。

除了最大最小值归一化还有其它的吗?

统计0到9出现的次数

给一个数字n,求1-n之间的所有数字中0出现了几次?1?2?。。。9?

数组中第一个不重复出现的数字

要求 一趟就解决它

思路[这个代码有问题,好烦啊]:

  • 倒序遍历数组,放入map
  • 如果map存在,value为出现次数,加1
  • 如果map不存在,index=i,记录当前元素位置。
  • 最后index的值就是第一个不重复的元素位置
import java.util.HashMap;
import java.util.Map;

public class Solution66
{
    public static void main(String[] args)
    {
        char[] array = {'d', 'a', 'b','d','c', 'c', 'b'};
        Map<Character,Integer> map = new HashMap<>();
        int index = -1;
        for(int i = array.length - 1; i>=0; i--)
        {
            if(map.containsKey(array[i]))
            {
                int count = map.get(array[i]);
                map.put(array[i],count+1);
            }
            else
            {
                map.put(array[i],1);
                index = i;
            }
        }

        System.out.println(index);
    }
}

思路2(面试官给出的思路,还不如第一个呢):

  • 遍历,hash存储元素出现次数和元素索引,为了下一步比较索引最小
  • 输出元素出现次数为1的并且索引最小
import java.util.HashMap;
import java.util.Map;

public class Solution65
{
    private static class CountIndex
    {
        public int getCount() {
            return count;
        }

        public void setCount(int count) {
            this.count = count;
        }

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        int count ;
        int index;
    }

    public static void main(String[] args)
    {
        char[] array = {'a', 'd', 'e', 'b','a', 'c', 'c', 'b'};
        Map<Object, CountIndex> map = new HashMap<>();

        int result = Integer.MAX_VALUE;

        for (int i=0;i<array.length;i++)
        {
            if(!map.containsKey(array[i]))
            {
                CountIndex countIndex = new CountIndex();
                countIndex.setCount(1);
                countIndex.setIndex(i);
                map.put(array[i],countIndex);
            }
            else
            {
                CountIndex countIndex = map.get(array[i]);
                countIndex.setCount(countIndex.getCount()+1);
                map.put(array[i],countIndex);
            }
        }

        for(int i=0; i<array.length;i++)
        {
            if(map.get(array[i]).count == 1 && result > map.get(array[i]).index)
            {
                result = map.get(array[i]).index;
            }
        }

        System.out.println(result);
    }

}

The Result

**你好

非常感谢你参加字节跳动的面试,我们非常欣赏你在面试过程中所表现出来的积极努力的态度。

很遗憾,经过简历评估和面试考察,我们认为你与本次招聘的岗位不匹配。我们已将你的资料保存在公司人才库中,今后如有合适岗位会再次联系你,也欢迎你继续关注我们。

如果你对本次招聘流程有任何意见或建议,欢迎发送反馈邮件至 hr-advice@bytedance.com

如果你想了解字节跳动的其他岗位请前往公司招聘官网查看 https://job.bytedance.com

再次感谢你对字节跳动的关注和认可,祝你工作顺利,生活愉快。

字节跳动人力资源部

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值