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

刷题贴 一年经验

全局:
请教一下楼主刷题的方法,楼主是自己想,自己写,再看答案?还是直接看答案的?
回复

使用道具 举报

🔗
 楼主| aokise 2018-6-9 01:35:05 | 只看该作者
全局:
huanghuan9210 发表于 2018-6-8 04:09
请教一下楼主刷题的方法,楼主是自己想,自己写,再看答案?还是直接看答案的?

刚开始几十道基本不会,看答案然后完全理解之后自己写一遍
后面都是自己想思路写,写完再看答案有没有优化,再写一遍优化解。
以前看答案写的经典好题一定要多复习,独立写几遍
回复

使用道具 举报

🔗
 楼主| aokise 2018-6-9 01:40:31 | 只看该作者
全局:
这次h1b被lay 刷题找工作圆满结束,历时两个半月
Passed:
1. Coupang,   120k base, 20k sign on, 10k stock
2. Microsoft,  120k base,  30k sign on, 90k stock, bonuse 20% base + 9k stock
3.Cisco Tetration, 145k base, 200k stock
4. Bloomberg, 160k base, 25k bonus, 25k sign on

Waiting:
1. Google
2. C3 IOT

Failed:
1. Opendoor
2. Another team in bloomberg
3. Groupon
4. segment

Canceled:
1. Goldman saches
2. Uber
(实在面不动了。。。uber还是很好的,以后有缘再面了)
回复

使用道具 举报

🔗
 楼主| aokise 2018-6-9 02:48:17 | 只看该作者
全局:
152. Maximum Product Subarray

class Solution {
    public int maxProduct(int[] nums) {
        if(nums.length ==0 ) return 0;
        int max = Integer.MIN_VALUE;
        int posMax = 1; int negMax = 1;
        for(int i =0; i< nums.length; i++) {
            if(nums[i] < 0) {
                int temp = posMax; posMax = negMax; negMax = temp;
            }
            posMax = Math.max(nums[i], posMax * nums[i]);
            negMax = Math.min(negMax*nums[i], nums[i]);
            
            max = Math.max(max, posMax);
        }
        return max;
            
        
    }
}
回复

使用道具 举报

🔗
 楼主| aokise 2018-6-9 02:48:25 | 只看该作者
全局:
128
class Solution {
    public int longestConsecutive(int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();
        int left =0, right = 0, cur = 0, curLen = 0, max = 0;
        for(int i =0; i < nums.length; i++){
            cur = nums[i];
            left = 0; right = 0;
            if(!map.containsKey(cur)){
                if(map.containsKey(cur-1)) left = map.get(cur-1);
                if(map.containsKey(cur+1)) right = map.get(cur+1);
                curLen = left+right+1;
                map.put(cur, curLen);
                max = Math.max(curLen, max);
                if(map.containsKey(cur-1)) map.put(cur -left ,curLen);
                if(map.containsKey(cur+1)) map.put(cur +right, curLen);
            }
        }
        return max;
    }
}
回复

使用道具 举报

🔗
 楼主| aokise 2018-6-9 02:48:36 | 只看该作者
全局:

142
/**
* Definition for singly-linked list.
* class ListNode {
*     int val;
*     ListNode next;
*     ListNode(int x) {
*         val = x;
*         next = null;
*     }
* }
*/
public class Solution {
    public ListNode detectCycle(ListNode head) {
        if(head == null || head.next == null) return null;
        ListNode slow = head, start = head;
        ListNode quick = head;
        while(quick!=null && quick.next != null) {
            quick = quick.next.next;
            slow = slow.next;
            if(quick == slow){
                while(start != slow){
                    start = start.next;
                    slow = slow.next;
                }
                return start;
            }
        }
        return null;
    }
}

回复

使用道具 举报

🔗
 楼主| aokise 2018-6-9 02:48:53 | 只看该作者
全局:

236

/**
* Definition for a binary tree node.
* public class TreeNode {
*     int val;
*     TreeNode left;
*     TreeNode right;
*     TreeNode(int x) { val = x; }
* }
*/
class Solution {
    public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
        if(root == null) return null;
        if(p == root) return p;
        if(q == root) return q;
        TreeNode l = lowestCommonAncestor(root.left, p, q);
        TreeNode r = lowestCommonAncestor(root.right, p, q);
        if(l != null && r != null) return root;
        if(l == null) return r;
        if(r == null) return l;
        return null;
    }
}
回复

使用道具 举报

🔗
hanling 2018-6-9 21:21:44 | 只看该作者
全局:
aokise 发表于 2018-6-8 09:40
这次h1b被lay 刷题找工作圆满结束,历时两个半月
Passed:
1. Coupang,   120k base, 20k sign on, 10k st ...

最后大神准备去哪儿了~
回复

使用道具 举报

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

本版积分规则

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