由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - uber 的一个面试题
相关主题
讨论一道题:找出一个board上的所有单词国内一家太阳能公司在招人
amazon面试题目讨论贴3问一个链表方面的算法问题 (转载)
被默据了,发amazon面经麻省南部小生物公司需part time一名,local only!
请教一道著名CS面试题:最大黑边正方形M家问题
谈谈刚面的一个design题在纽约上班的人怎么搞Phone Interview? (转载)
考大家一道SQL面试题microfluids和solar cell这两个方向哪个好找工作啊? (转载)
急问两道面试题Need an intern this summer -- cell phone camera application engineer
想请教一道面试题求fuel cell工作机会!!!!
相关话题的讨论汇总
话题: cell话题: value话题: type话题: cells话题: class
进入JobHunting版参与讨论
1 (共1页)
h******e
发帖数: 52
1
设计一个 data structure something like excel's cell.
The cell has two types: value type and formula type (sum of other cells). My
design is as below.
Class Cell
{
rowId;
ColId;
type; //enum-> value or sum of other cells
Value; //if type is value, this field is the value, otherwise
meaningless
List cell; // if type is forumla, the field is used to show which
other cells are needed to sum
}
是不是还有更好的design?
d****r
发帖数: 300
2
Some kinda listener design pattern to catch data change event in other cells
and notifier pattern to notify other cells your data change event.

My

【在 h******e 的大作中提到】
: 设计一个 data structure something like excel's cell.
: The cell has two types: value type and formula type (sum of other cells). My
: design is as below.
: Class Cell
: {
: rowId;
: ColId;
: type; //enum-> value or sum of other cells
: Value; //if type is value, this field is the value, otherwise
: meaningless

f*******r
发帖数: 976
3
能否展开来讲解?

cells
设计一个 data structure something like excel's cell.
The cell has two types: value type and formula type (sum of other cells). My
design is as below.
Class Cell
{
rowId;
ColId;
type; //enum-> value or sum of other cells
Value; //if type is value, this field is the value, otherwise
meaningless
List cell; // if type is forumla, the field is used to show which
other cells are needed to sum
}
是不是还有更好的design?

【在 d****r 的大作中提到】
: Some kinda listener design pattern to catch data change event in other cells
: and notifier pattern to notify other cells your data change event.
:
: My

s****9
发帖数: 2
4
Imagine that a cell is of formula type and its cell's value is a list of
cells. If any of cells gets changed, the parent cell should change
accordingly. It needs a notifier in child cell and a listener in parent
cell working together to do it.
t*********r
发帖数: 387
5
为啥不用inheritance?
public abstract class Cell {
int getRow();
int getColumn();
notify();

public class Value extends Cell {
Object getValue();
}
public class Formula extends Cell {
List sums();
}
N********n
发帖数: 8363
6

你放个TYPE进去基本上要秒FAIL的。用OO思路,CLASS本身就是TYPE。应该
有个BASE CLASS CELL存通用信息,然后SUBCLASS VALUE CELL和SUBCLASS
FORMULA CELL存特定信息,从BASECLASS继承通用信息。酱紫。

【在 h******e 的大作中提到】
: 设计一个 data structure something like excel's cell.
: The cell has two types: value type and formula type (sum of other cells). My
: design is as below.
: Class Cell
: {
: rowId;
: ColId;
: type; //enum-> value or sum of other cells
: Value; //if type is value, this field is the value, otherwise
: meaningless

l*****a
发帖数: 14598
7
你都打算支持什么操作?
用row/column查找cell的操作在excel中应该是O(1),你这个...

My

【在 h******e 的大作中提到】
: 设计一个 data structure something like excel's cell.
: The cell has two types: value type and formula type (sum of other cells). My
: design is as below.
: Class Cell
: {
: rowId;
: ColId;
: type; //enum-> value or sum of other cells
: Value; //if type is value, this field is the value, otherwise
: meaningless

l*****a
发帖数: 14598
8
Formula也可以有getValue() ah, so u can put it in the base class
for notify(), I think only Value cell need that...

【在 t*********r 的大作中提到】
: 为啥不用inheritance?
: public abstract class Cell {
: int getRow();
: int getColumn();
: notify();
: }
: public class Value extends Cell {
: Object getValue();
: }
: public class Formula extends Cell {

1 (共1页)
进入JobHunting版参与讨论
相关主题
求fuel cell工作机会!!!!谈谈刚面的一个design题
诚聘cell culture scientist(中国苏州) (转载)考大家一道SQL面试题
求apple内部refer 本职位Battery Test Engineer and or Battery Cell Development急问两道面试题
word search BST 解法,大测试超时,请大家指点迷津想请教一道面试题
讨论一道题:找出一个board上的所有单词国内一家太阳能公司在招人
amazon面试题目讨论贴3问一个链表方面的算法问题 (转载)
被默据了,发amazon面经麻省南部小生物公司需part time一名,local only!
请教一道著名CS面试题:最大黑边正方形M家问题
相关话题的讨论汇总
话题: cell话题: value话题: type话题: cells话题: class