由买买提看人间百态

topics

全部话题 - 话题: resized
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
a***e
发帖数: 413
1
来自主题: JobHunting版 - Pascal's Triangle II 的优化解?
问道简单题,
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Could you optimize your algorithm to use only O(k) extra space?
对下面这种优化解总觉得不是很清楚。感觉如果不是自己想出来的东西下次又会忘,有
没有同学解释下原理?为啥内循环要从右忘左扫?多谢!
vector getRow(int rowIndex) {
vector res;
if (rowIndex<0) return res;

res.resize(rowIndex+1);
res[0]=1;

for (int i=1; i {
for (int j=i; j>=1; j-... 阅读全帖
S*******C
发帖数: 822
2
来自主题: JobHunting版 - Array Length encoding求思路!
Array Length encoding: 给定binary数组(比如[1010]), 计算每个digit数量, 返回这
种形式([11011101]).
写到一半, 小哥说你再写代码么,我这里没显示, 后来复制+刷新+粘贴搞定(
collabedit的bug),虚惊一场. 期间讨论比较多,比如array resizing(后来用了
ArrayList), input的边界条件等, lz拙计的听力, 一路pardon过来......
follow up: 怎么设计testcase, 我说random生成0,1, 又问怎么知道输出是对的?这
里纠结了好久,一开始以为要再写一种方法判断正确性. 后来发现小哥的意思是random
生成的input如何通过output判断是不是正确的,我说生成好以后存起来或打出来,然
后和output对照, 小哥说make sense.(lz感觉这里好像是领会错意思了,还浪费了不少
时间, 求问大家这里小哥到底想问什么。。。)
g******n
发帖数: 10
3
来自主题: JobHunting版 - LC的3sum谁有简洁代码?
这题可以在循环内手动去重,也可以把 triplets 存到 hash set 里自动去重,函数返
回时再转回 list。前者代码略显啰嗦但时间复杂度最坏是 O(n^2),后者代码更简洁但
时间复杂度更高,平均情况 O(n^2),最坏情况 O(n^4)(例如共有 O(n^2) 个
triplets,全部被 hash 到同一个 bucket,每次插入都是 O(n^2),所以总的时间复杂
度是 O(n^4))。C++ 可以用 hash set 也可以先统一把 triplets 存到 vector<
vector> 里,然后 sort + unique + erase / resize 搞定。但是 C++ 这两种方
法都会超时,必须手动去重,Java 和 Python 用 hash set 都能过 OJ。
--------------------------------------------------------------------------
Java 版代码如下:
public class Solution {
public List>... 阅读全帖
s********n
发帖数: 62
4
还是用vector resize下安稳吧
t*********3
发帖数: 87
5
你发的网页里的东西我能读懂,我自己也写过*p那种动态数组resize,就是满了就乘以
2。
但是我还是不理解为什么你的回答和我的问题相关:
int local[days][k+1] = {0}; //-> Compile OK but run error, if I
define the array in this way. Why?

它的
r*g
发帖数: 186
6
来自主题: JobHunting版 - L家这题咋搞,巨变态
这样行不
层次遍历原来的树, 每次收集N个节点放到新树
TreeNode *convertNTree(TreeNode *root, int N)
{
TreeNode *new_tree = root;
std::queue q1, q2;
std::list chd;
q1.push(root);
q2.push(root);
while(!q1.empty()){
if(chd.size() < N){
for(auto p: q1.front().children){
q1.push(p);
}
q1.front().children.resize(0);
chd.push_back(q1.front());
q1.pop();
}else{
std::swap(q2.front... 阅读全帖
w*********e
发帖数: 49
7
来自主题: JobHunting版 - Uber 电面面经
刚面的,印度小哥,45分钟
15分钟对方背景介绍,介绍自己project,为什么要来uber
15分钟基本功题一道:找string中所有单词frequency并排序输出
比如 “cat bat man bat cat”
输出
man:1
bat:2
cat:2
需要自己决定如何输入输出,外加跑unit test
coderpad上需要编译通过运行。我编程一向粗心,整个过程出了四次编译错误,不过幸
好对方看起来不太在意。
10分钟hash table概念深度扫描
hashtable怎么实现:各种方法blabla
让你选你用哪种:各种优劣对比blabla
不断加入元素后如何维护性能: load factor rehash blabla
hashtable array长度一般怎么选,rehash/resize对时间复杂度影响
还剩快十分钟的时候小哥就想挂电话走人的样子,强行拉住问了两问题拖到45分钟,结
束。
另外再次感谢uber growth组的mitbbsfanfan内推,哥们非常热心,虽然最后被growth
组recruiter踢到别的组,还是很感谢提供这个机会!
i********y
发帖数: 34
8
来自主题: JobHunting版 - 请教一道面试题
class Solution {
vector counts;
public:
int getPrimeCount(int n, int k) {
while (1) {
// make sure k is prime
while (k < n && counts[k] != 1) ++k;
if (n%k == 0) {
while (n%k == 0) n /= k;
return counts[n] + 1;
}
++k;
}
}
vector solve(int n) {
counts.resize(n + 1);
vector ret;
for (int i = 2; i <= n; ++i) {
int count = getPr... 阅读全帖
j******t
发帖数: 788
9
来自主题: JobHunting版 - 问个G家面试题
How about using unsorted_map, paired with the {number, id}. number
represents the number in the array, id is the position of the number in the
input array. Anyone can tell me what is the complexity of the following
solution? The complexities of both unsorted_map::find and unsorted_map::
insert are O(n).
vector Solution(vector str_list, vector ppos_list)
{
std::unsorted_map table;
vector res;
for(int i =0; i {
table.insert({ppos_list[i]... 阅读全帖
n****l
发帖数: 1739
10
来自主题: JobHunting版 - 狗也雷人啊?
I hope they laid off or fired the UI leads of chrome:
---------------------------
Seemingly no way to do a case-sensitive Ctrl+F text search
Comment 32 by [email protected]/* */, Apr 6 2011
Labels: -Review-UI
Status: WontFix
Discussed w/ UI leads: This would be nice to have, but we're not willing to
add the options to the UI at this time.
------------------------------
not to mention other really old window resizing bugs on Windows that never
get fixed.
T*****g
发帖数: 1306
11
来自主题: JobHunting版 - 请教大侠们hash table 多线程问题
哥们你做过synchronization相关的工作么?你知道你一个bucket有100个element,多
线程同时写在mutex上要等多久么?不过你提的这个throughput可能用mutex也能达到,
只能说你是没见过高性能的salable hashtable
不要误导人了,谁告诉你要copy一整条bucket来做copy on write?(有人提到RCU了,
RCU就可以做)。RCU的难点只在于resize的时候不好处理,不过已经有人把这个问题解
决了。

如,
A*******5
发帖数: 690
12
来自主题: JobHunting版 - Software Engineer – Front End
不要小看我们前端哦。其实很多时候大家说前端,不是纯UI,而是JavaScript related
的一切scripts, web, HTTP 等等。
而作为前端,要求不只是能work,而是完美,一个serious business是不允许UI错误或
者不完美出现的,比如responsive ,cross browser error,一旦有,会大大降低用户
的信赖,如果是新产品,前端其实很重要,用户根本不了解产品功能,如果看起来就很
low的话,人家根本懒得去进一步了解产品,也不会信任这个产品。比如一个新的购物
网站,resize以后那图片文字有重叠或者错位,有时页面点不开,谁敢在他家买东西呢
?当然已经很有名或老牌的网站不在此列,例如a &f, 我都摸出规律他们周六夜里到周
日早晨更新了。
而且我们前端也能写算法的,那些hierarchy tree 结构的object,还有那些扫描处理
HTMLelements 的plugin, 比如 JS Dom, parse,等等,虽然JavaScript 不能
iterative traverse tree,但我们还是能用call back写 r... 阅读全帖
m********t
发帖数: 9426
13
不一定
我也没resize黑白
看来看店员心情
t******2
发帖数: 2265
14
来自主题: Living版 - 5 myths about home sweet homeownership
5 myths about home sweet homeownership

TOOLBOX
Resize
Print
E-mail
Yahoo! Buzz
COMMENT
47 Comments | View All »
COMMENTS ARE CLOSED
Your browser's settings may be preventing you from commenting on and viewing
comments about this item. See instructions for fixing the problem.
Discussion Policy
CLOSE
Comments that include profanity or personal attacks or other inappropriate
comments or material will be removed from the site. Additionally, entries
that are unsigned or contain "signatures
q******g
发帖数: 43
15
首饰店做个bar,或者resize一下,做个bar很快很简单。
t****z
发帖数: 1551
16
去卖的地方resize就好
narrow down 好像都免费的亚
H******7
发帖数: 34403
17
来自主题: Living版 - 总结下家居版几大神器
good,版主要置顶加精献花默哀

http://www.ventingdirect.com/imagebase/resized/330x320/zephyrimages/zephyr
_ak2100a_11232010.jpg
range-hood-with-850-cfm-internal-blower-and-self-cleaning-function/p624847
z*********8
发帖数: 2070
18
来自主题: Living版 - 总结下家居版几大神器
mark

http://www.ventingdirect.com/imagebase/resized/330x320/zephyrim
_ak2100a_11232010.jpg
range-hood-with-850-cfm-internal-blower-and-self-cleaning-function/p624847
H******7
发帖数: 34403
19
来自主题: Living版 - 总结下家居版几大神器
good,版主要置顶加精献花默哀

http://www.ventingdirect.com/imagebase/resized/330x320/zephyrim
_ak2100a_11232010.jpg
range-hood-with-850-cfm-internal-blower-and-self-cleaning-function/p624847
N**s
发帖数: 1916
20
来自主题: Living版 - 大家都是哪里买blinds的?
WalMart's blinds are much cheaper, however they don't resize.
You can install them yourself but a little time consuming.
s*********e
发帖数: 4475
21
来自主题: Living版 - 不大明白这房子的价格
这房子显然是豪宅了。 去年开始想以137.5万买, 没成。 一下子降到109.9万。
137.5万撑了那么久, 为什么一下子降这么多呢?
还有, 这房子是九几年建的, 2001年9月卖了51万五, 好像也忒低了一些。
http://www.zillow.com/homedetails/07430/37952777_zpid/
http://www.njmls.com/listings/index.cfm?action=dsp.info&mlsnum=
http://sandbox.xmlsweb.com/PictureMaint/ShowPhoto.aspx?
id=1109597&num=1&resize=Y
z********1
发帖数: 35
22
那个是6寸还是8寸的洞?如果是6寸的,能resize管子成3寸的么?3寸的会影响抽油烟
机的使用性能么?
y****i
发帖数: 5690
23
有个窗户上面的断掉了 哪里去买呢
http://homeguides.sfgate.com/DM-Resize/photos.demandstudios.com
e/142/215/86545393_XS.jpg?w=300&h=300&keep_ratio=1
这种样子的 装在屋子里头的 纯装饰效果的 啥贼也防不了其实
LOWES问过 没有卖的
w*****m
发帖数: 20421
24
来自主题: Living版 - 浴室重装能用handyman吗?
太大了,RESIZE一下,你这个厕所我可以给你看看,能花多少钱做多少
l****o
发帖数: 640
25
来自主题: Living版 - 浴室重装能用handyman吗?
怎么resize啊?909k,word文档能贴, 这儿不能贴。
你知道我在哪儿吗?可不是加州唉。
z*****8
发帖数: 2546
26
来自主题: Living版 - 不用脏手的播橙子皮的方法
no still at work.
the following I use to monitor to see if my website is down or not. Save to
a file and open it with your browser.