回复: 6
跳转到指定楼层
上一主题 下一主题
收起左侧

字节跳动挂经

全局:

2019(4-6月) 码农类General 本科 实习@字节跳动 - 网上海投 - 技术电面  | Fail | 应届毕业生

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

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

x
1. 把url输入进浏览器跳转网页的过程发生了什么
2.process之间怎么交流
3.http和https有什么区别?
4.process和thread有什么区别?
5.有什么design pattern
6.写一下java singleton
  1. // not thread safe. 1point 3 acres
  2. public class Singleton {  
  3.     private static Singleton instance;  
  4.     private Singleton (){}  . Waral dи,
  5.   
  6.     public static Singleton getInstance() {  
  7.     if (instance == null) {  
  8.         instance = new Singleton();  
  9.     }  
  10.     return instance;  
  11.     }  
  12. }  
复制代码



  1. // thread safe
  2. public class Singleton {  
  3.     private static Singleton instance;  
  4.     private Singleton (){}  . .и
  5.     public static synchronized Singleton getInstance() {  . check 1point3acres for more.
  6.     if (instance == null) {  
  7.         instance = new Singleton();  .--
  8.     }  
  9.     return instance;  
  10.     }  
  11. }  
复制代码
. From 1point 3acres bbs


写一下atoi
  1. ublic int myAtoi(String str) {. Χ
  2.         // if input string is empty, return 0
  3.         if (str == null || str.isEmpty())
  4.                 return 0;

  5.         // save input string size
  6.         int n = str.length();. Χ

  7.         // skip spaces
  8.         int index = 0;
  9.         while (index < n && str.charAt(index) == ' ') {
  10.                 index++;
  11.         }-baidu 1point3acres

  12.         // reached the end of string, return 0
  13.         if (index == n)
  14.                 return 0;

  15.         // calculate sign
  16.         int sign = str.charAt(index) == '-' ? -1 : 1;

  17.         // move to next char if sign is present
  18.         if (str.charAt(index) == '-' || str.charAt(index) == '+') {
  19.                 index++;. 1point3acres
  20.         }. From 1point 3acres bbs

  21.         // reached the end of string, return 0. Waral dи,
  22.         if (index == n)
  23.                 return 0;
  24. . 1point3acres.com
  25.         // calculate max value without last digit
  26.         // -2,147,483,647 -> -2,147,483,64
  27.         int max = Integer.MAX_VALUE / 10;
  28.         // calculate last digit
  29.         // 2,147,483,647 -> 7 or -2,147,483,648 -> 8
  30.         int lastMaxDigit = sign > 0 ? Integer.MAX_VALUE - max * 10 : -(Integer.MIN_VALUE + max * 10);. 1point 3 acres

  31.         // result without sign
  32.         int number = 0;
  33.         // loop until end or until character is digit
  34.         while (index < n && str.charAt(index) >= '0' && str.charAt(index) <= '9') {. 1point3acres
  35.                 // convert character to digit
  36.                 int digit = str.charAt(index) - '0';
  37.                 // if number is greater than max without last digit
  38.                 // or number is equal max without last digit but last digit is greater then max last digit
  39.                 // return integer max or min, depend on sign. From 1point 3acres bbs
  40.                 if (number > max || number == max && digit >= lastMaxDigit) {
  41.                         return sign > 0 ? Integer.MAX_VALUE : Integer.MIN_VALUE;
  42.                 }. Χ

  43.                 // accumulate current digit to result. .и
  44.                 number = number * 10 + digit;
  45.                 // move to next character
  46.                 index++;
  47.         }

  48.         // add sign to number and return result.--
  49.         return sign * number;
  50. }
复制代码



.

补充内容 (2019-8-20 15:39):
附一个楼主准备面试的时候从newcoder爬下来的面经:
https://docs.google.com/document ... jU/edit?usp=sharing

评分

参与人数 7大米 +48 收起 理由
hptg1994 + 1 给你点个赞!
emersonxsu + 1 赞一个
Harue_Go + 2 谢谢分享!
oscarpoint + 1 很有用的信息!
admin + 40

查看全部评分


上一篇:微软北京面经
下一篇:字节跳动2019校招数据分析一面面筋 求加米
🔗
FeFe 2019-9-1 11:08:52 来自APP | 只看该作者
全局:
谢谢卤煮分享
回复

使用道具 举报

全局:
请问楼主面的是哪个岗位呀
回复

使用道具 举报

🔗
jjjjnnn410 2019-12-11 11:27:21 | 只看该作者
全局:
楼主这个是什么职位呀
回复

使用道具 举报

🔗
Warren 2019-12-11 14:49:28 | 只看该作者
全局:
这个还是比较简单啊
回复

使用道具 举报

🔗
 楼主| cecilianxf 2019-12-14 18:06:19 | 只看该作者
全局:
会飞的猪猪侠 发表于 2019-12-5 15:38
请问楼主面的是哪个岗位呀
.1point3acres
java backend
回复

使用道具 举报

🔗
 楼主| cecilianxf 2019-12-14 18:06:41 | 只看该作者
全局:
Warren 发表于 2019-12-11 14:49
这个还是比较简单啊

刚上完大一去面的 还是太年轻。
回复

使用道具 举报

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

本版积分规则

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