由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 这两道题(CareerCup 150)的答案是不是有问题啊?
相关主题
careercup书上一个老题请教CareerCup中的ROBOT MATRIX PATH那道题
求分析这题的时间复杂度两道google的onsite题目
问个老题 - max submatrix with the same border问两道微软题
Amazon algorithm question, googlecareercup上的一道题
抛砖引玉:Careercup 150题中的错误求教两道面试题
~~问两道AMAZON电面题bit manipulation 小题
careerup 150的一道经典题问个google面试题
问道面试题careercup一道amazon的面试题
相关话题的讨论汇总
话题: square话题: column话题: subcolumn话题: step
进入JobHunting版参与讨论
1 (共1页)
s*********0
发帖数: 89
1
大家觉得呢?
Imagine you have a square matrix, where each cell is filled with either
black or
white. Design an algorithm to find the maximum subsquare such that all four
borders are filled with black pixels.
Assumption: Square is of size NxN.
This algorithm does the following:
1. Iterate through every (full) column from let to right.
2. At each (full) column, look at the subcolumns (from biggest to smallest).
3. At each subcolumn, see if you can form a square with the subcolumn as the
left side. If
so, update currentMaxSize and go to the next (full) column.
4. If N - col <= currentMaxSize, then break completely. We’ve found the
largest square
possible.
。。。
Time complexity: O(N^2)
不觉得可以是O(N^2). 光是step 2就要N^2了。加上step 1的循环,就是N^3了。而且
step 3要用O(1)需要pre-processing.
j******8
发帖数: 191
2
too simple, sometimes too naive.

four
smallest).
the

【在 s*********0 的大作中提到】
: 大家觉得呢?
: Imagine you have a square matrix, where each cell is filled with either
: black or
: white. Design an algorithm to find the maximum subsquare such that all four
: borders are filled with black pixels.
: Assumption: Square is of size NxN.
: This algorithm does the following:
: 1. Iterate through every (full) column from let to right.
: 2. At each (full) column, look at the subcolumns (from biggest to smallest).
: 3. At each subcolumn, see if you can form a square with the subcolumn as the

1 (共1页)
进入JobHunting版参与讨论
相关主题
careercup一道amazon的面试题抛砖引玉:Careercup 150题中的错误
A blackbox function f(x)~~问两道AMAZON电面题
amazon questioncareerup 150的一道经典题
请教一道careercup 150上的题问道面试题
careercup书上一个老题请教CareerCup中的ROBOT MATRIX PATH那道题
求分析这题的时间复杂度两道google的onsite题目
问个老题 - max submatrix with the same border问两道微软题
Amazon algorithm question, googlecareercup上的一道题
相关话题的讨论汇总
话题: square话题: column话题: subcolumn话题: step