📣 Back to School开学季 - VIP通行证5折优惠!蓝莓、Offer多多同步优惠
楼主: pxu
跳转到指定楼层
上一主题 下一主题
收起左侧

刷题打卡 -pxu

🔗
 楼主| pxu 2018-5-19 05:37:25 | 只看该作者
全局:
295. Find Median from Data Stream - resolved with max and min heap. make sure the size of those two are balanced.
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-19 08:22:00 | 只看该作者
全局:
305 Number of Islands II - resolved it with union find. tricky:
int rootOfCurr = find(roots, curr);
                if(rootOfCurr != root){
                    roots[root] = rootOfCurr;
                    count--;
                   root = rootOfCurr;
                }
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-19 11:33:12 | 只看该作者
全局:
355. Design Twitter  - I worked this all by myself and AC, yeah. after reviewing the discussion, I abstract User class with will implement follow and unfollow with it. more like OOD question now.
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-19 11:57:41 | 只看该作者
全局:
just refactored the twitter codes and feel much better now. so, it's not just making it work, it should ood orientated
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-20 15:46:05 | 只看该作者
全局:
207. Course Schedule  - using dfs and go throught each nodes
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-21 03:07:56 | 只看该作者
全局:
348. Design Tic-Tac-Toe . First, I was using OOD to keep all the data and was able to AC. After reviewing the discussion, one of the them is brilliant. it only checked the sum so far, e.g.    int rows[], cols[], diagonals, antiDiagonals;     int size;     /** Initialize your data structure here. */     public TicTacToe(int n) {         size = n;         rows = new int[n];         cols = new int[n];     }
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-21 06:34:42 | 只看该作者
全局:
#186 Reverse Words in a String II
forgot to shift left++ and right--
remember to handle the edge case(i.e in the end)
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-21 08:27:22 | 只看该作者
全局:
#325Maximum Size Subarray Sum Equals k added map.put(0, -1) to make it easy to calculate distance try to finish everything in one loop
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-21 09:51:13 | 只看该作者
全局:
#Longest Palindromic Substring - Forgot to write the  else case if(s.charAt(left) == s.charAt(right)){}else{return;}. remembered to shift left to left and right to right side
回复

使用道具 举报

🔗
 楼主| pxu 2018-5-21 10:23:54 | 只看该作者
全局:
238. Product of Array Except Self - using leftside and rightside to handle multiplication before it self.

for(int i = 1; i < nums.length; i++){
            res[i] = leftSides * nums[i-1];
            leftSides = res[i];
        }
        
        for(int i = nums.length -2; i >=0; i--){
            res[i] *= rightSides * nums[i+1];
            rightSides = rightSides * nums[i+1];
        }
回复

使用道具 举报

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

本版积分规则

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