12
返回列表 发新帖
楼主: newgod2500
跳转到指定楼层
上一主题 下一主题
收起左侧

Pure Storage 电面

🔗
new2500 2017-9-19 10:04:38 | 只看该作者
全局:
lcq123 发表于 2017-9-19 10:02
请问楼主多线程的event, fire那道是哪一道?是地里的吗?谢谢!

很久没follow up面经了。如果你指的的是老四道里面的那道的话,

是的。
回复

使用道具 举报

🔗
lcq123 2017-9-19 10:16:10 | 只看该作者
全局:
new2500 发表于 2017-9-19 10:04
很久没follow up面经了。如果你指的的是老四道里面的那道的话,

是的。

好的,谢谢
回复

使用道具 举报

🔗
wajch 2017-10-30 06:38:59 | 只看该作者
全局:

哈哈哈哈哈 纯粹给lz的机智幽默点赞
回复

使用道具 举报

🔗
yiguzuoqi 2017-11-1 07:03:14 | 只看该作者
全局:
贴一个一堆点算有多少个正方形的code,欢迎指正

    public int squareCount(Point[] points){
        int count = 0;
        if(points == null || points.length <= 3){
            return 0;
        }
        
        HashSet<Point> set = new HashSet<Point>();
        for(Point p : points){
            set.add(p);
        }
        
        for(int i = 0; i < points.length; i++){
            for(int j = 0; j < points.length; j++){
                if(i == j){
                    continue;
                }
                Point[] otherPoints = getOtherPoints(points[i], points[j]);
                if(set.contains(otherPoints[0], otherPoints[1])){
                    count++;
                }
            }
        }
        return count;
    }
回复

使用道具 举报

🔗
yiguzuoqi 2017-11-1 07:09:09 | 只看该作者
全局:
没发getOtherPoint

    public int squareCount(Point[] points){
        int count = 0;
        if(points == null || points.length <= 3){
            return 0;
        }
        
        HashSet<Point> set = new HashSet<Point>();
        for(Point p : points){
            set.add(p);
        }
        
        for(int i = 0; i < points.length; i++){
            for(int j = 0; j < points.length; j++){
                if(i == j){
                    continue;
                }
                Point[] otherPoints = getOtherPoints(points[i], points[j]);
                if(set.contains(otherPoints[0], otherPoints[1])){
                    count++;
                }
            }
        }
        return count;
    }
   
    private Point[] getOtherPoints(Point pa, Point pc){
        Point[] result = new Point[2];
        
        int midX = (pa.x + pc.x) / 2;
        int midY = (pa.y + pc.y) / 2;
        
        int ax = pa.x - midX;
        int ay = pa.y - midY;
        int bx = midX - ay;
        int by = midY + ax;
        Point b = new Point(bx, by);
        
        int cx = pc.x - midX;
        int cy = pc.y - midY;
        int dx = midX - cy;
        int dy = midY + cx;
        Point b = new Point(dx, dy);
        
        result[0] = b;
        result[1] = d;
        return result;
    }

补充内容 (2017-11-9 08:28):
应该是if(set.contains(otherPoints[0])&& set.contains(otherPoints[1]))
还不对,还要搞个String Set,每一个String由用过的点的index组成,记录用过的组合
回复

使用道具 举报

🔗
wjw779 2017-11-8 14:07:46 | 只看该作者
全局:
yiguzuoqi 发表于 2017-11-1 07:09
没发getOtherPoint

    public int squareCount(Point[] points){

层主好,
if(set.contains(otherPoints[0], otherPoints[1])){
                    count++;
}

请问这里set.contains()不能这么用吧?
回复

使用道具 举报

🔗
yiguzuoqi 2017-11-9 08:25:14 | 只看该作者
全局:
wjw779 发表于 2017-11-8 14:07
层主好,
if(set.contains(otherPoints[0], otherPoints[1])){
                    count++;

哦哦, 不能,应该是contains && contains,笔误
回复

使用道具 举报

🔗
LeonJLYH 2018-1-28 09:29:28 | 只看该作者
全局:
楼主你好, 下周要约onsite了。能跟你请教几题面精的问题吗?
回复

使用道具 举报

🔗
ld_xixi 2018-9-28 06:31:15 | 只看该作者
全局:
然后follow up是给一大堆坐标,能组成多少个正方形 请问这个楼主怎么解的? 多谢
回复

使用道具 举报

🔗
roy119120 2018-10-3 23:30:20 | 只看该作者
全局:
follow up应该只能暴力节吧?
回复

使用道具 举报

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

本版积分规则

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