p*****2 发帖数: 21240 | 1 - Simple regular expression match,可以match的符号只有3种:
a-z : match a-z
a+ : match any numbers of a
.+ : repeat 1 - arbitrary times
和没用过regex的同学解释一下 例如
a+b 可以match : ab, aab, aaaaaaaaaaab
b.+b 可以match : bb, bab, b12345b
这道题有个疑问。+是1到多吧?
.+就是任意字符,但是至少要有一个任意字符吧?这样的话,bb就不match "b.+b"了吧?
*是0到多个,所以bb match "b.*b"
我的理解有问题吗? |
|
C***U 发帖数: 2406 | 2 Simple regular expression match,only 3 possible patterns:
a-z : match a-z
a+ : match any numbers of a
.+ : repeat 1 - arbitrary times
和没用过regex的同学解释一下 例如
a+b 可以match : ab, aab, aaaaaaaaaaab
b.+b 可以match : bb, bab, b12345b
有什么好的办法没? |
|
a*****8 发帖数: 10 | 3 碰到的一题online coding
Given a string s, return the shortest substring that is only occurring once.
Examples:
s="aabbabbaab" retunrs either "bab" or "baa"
s="aaaa" returns "aaaa"
大家看看有什么好的想法 |
|
t****a 发帖数: 1212 | 4 这题怎么用greedy来做呢?DP的话是n*m计算量
memoize dp的解
(defn is-match [str1 str2]
(let [str1a (str str1 \a)
str2a (str str2 \a)
n1 (count str1a)
n2 (count str2a)
seq2 (apply concat (repeat n1 (range n2 -1 -1)))
seq1 (mapcat #(repeat n2 %) (range n1 -1 -1))
]
(do
(def is-match-rec
(memoize
(fn [i1 i2]
(let [l1 (- n1 i1)
l2 (- n2 i2)]
(cond (and (== 0 l1) (== 0 l2)) true
(or (=... 阅读全帖 |
|
x******a 发帖数: 6336 | 5 例如ABABCD, BABDC,
longest common consecutive sequence 是“BAB”
谢谢 |
|
f*****e 发帖数: 2992 | 6 应该是BAB,而且用二爷拿手的trie比较好吧。:-) |
|
p*****2 发帖数: 21240 | 7 有一个字符串,长度n,由k个字母组成 2<=k<=26, 都是大写字母
你可以替换任意一个字符为其他的字符,问如何以最少的次数替换,使得相邻的字母不
同。需要输出最少的次数和结果。
比如
n k
6 3
ABBACC
2
ABCACA
3 2
BBB
1
BAB |
|
l*********4 发帖数: 112 | 8 有一个binary directed acyclic graph, 每个node存有一个字符,有一个左节点和一
个右节点。
(node定义如下:
Node {
Node L;
Node R;
char ch;
}
)
这样如果in-order traverse这个DAG,就会得到一个string。例子如下:假设一个DAG
只有两个node,分别装着A和B这两个字符。假设Node A的左右两条边都指向Node B:
A (root node)
||
B
那么这个存储的string就是BAB
现在假设已经有了一个这样的DAG, 请写一个函数,返回这个string的第k个字符。要求
复杂度不能是exponential的。。。
我先写了个in order 的遍历。面试官就问我如果n个node,string最长可以是多少
我觉得是2^n-1
面试官说,那么traverse的话最坏情况复杂度就是O(2^n),不符合要求~
谢谢大家指教! |
|
l*********4 发帖数: 112 | 9 面试官先问我如果n个node,string最长可以是多少
我觉得是2^n-1
于是面试官说,traverse的话最坏情况复杂度就是O(2^n)啦,不符合要求。于是我就无
语凝噎了。。。
另外,遍历时访问过的node是可以再次访问的。比如那个两个节点的例子
A
||
B
A是root
in order 先访问B,再访问A,可是A的right edge指向的还是B,于是要再访问B。所以
这两个node的图表示的string是BAB |
|
M*******a 发帖数: 1633 | 10 就是说给一串字符,可能有重复字符,然后用这些字符permutation(都要用完),总
共可以形成多少个不重复字符串
比如abb -> abb, bab, bba,那就是三个。
只要结果数量,不用输出字符串集合 |
|
|
|
f********l 发帖数: 43 | 13 I really understand you~~~
My baby took two times X-ray within 20 days,and I regretted very much about
it after we were discharged from hospital.I dared not to refuse the X-ray
cause I don't want to offense the doctor. But I really don't like my baby's
cardiologist--she was the attending doctor when we went to the ER.I had no
choice to choose.
I presented many questions to doctors and nurses,they only felt that I had
too many questions and they always answered me in that way"we did with lots
bab |
|
|
|
|
c*******u 发帖数: 12899 | 17 ☆─────────────────────────────────────☆
wingsheart (我心飞翔) 于 (Sun Apr 25 10:28:21 2010, 美东) 提到:
得攒攒人品了,小人最近特别天使,呵呵
我是后妈型,2个月前宝宝基本不怎么睡,快崩溃了,只好sleep trainning
从10:30睡,到2点准时醒,再慢慢想办法推到3点,4点,5点
现在是9:30就仍crib,小人自己从5点醒,渐渐到6点醒
今天是第115天,7:12醒来
妈妈我真是感觉太幸福了
不过,战斗是长期的
过几天小人就要打4个月的疫苗了,也要上辅食了,说不定有什么变化
发30个包子,攒点人品,希望小人健康快乐
另,强烈推荐照片里的Graco Contempo Highchair
我家小人一坐进去就开心得不得了,“呜呜呜”叫个不停,吃饭的时候也不用抱着他了
BTW,靠背有3个挡,最斜的那个靠着就跟抱腿上差不多,so不到4个月就坐上了
当时去店里跟传说中的Fisher-Price Rainforest做了比较
个人觉得这款的颜色更加简单大方,空间更充裕
如果不在乎颜色的话,bab |
|
|
s****n 发帖数: 234 | 19 马上要离开boston,转让一下女儿用的东东。
2007 Da Vinci Jenny Lind Crib, color oak (convertible to toddler bed, very
easy to install,original $220), 2007 Sealy Mattress (204 innerspring coils,
original $99). Totally ask $100.
The first year infant car seat with base ( bought last Christmas for my
daughter, barely used) ask $60.
Fisher-price Laugh & Learn jumperoo (bought a few months ago, barely used,
look like new) ask $80.
照片Link:
http://boston.craigslist.org/bmw/bab/1847633630.html
还有一些东西,免费赠送(装diaper垃圾桶,宝宝的凳子 |
|
q*********8 发帖数: 5776 | 20 http://www.wholesomebabyfood.com/MeatRecipes.htm
Chicken Purée (Basic)
Ingredients:
1 cup cold and cooked boneless chicken - chopped into no bigger than 1 inch
pieces
1/4 c cooking juice (save the juices that you cooked the meat in) or plain
water
Directions:
Place chicken chunks in blender or food processor and puree until a powdery
mix is formed. Slowly add water and puree further until a smooth consistency
is created.
Add as much liquid as needed to make a consistency appropriate for your bab |
|
h******n 发帖数: 315 | 21 刚刚在craigslist上闲逛,看到一个超级好deal,和jms分享一下
我自己刚刚跳了一个,code是好用的
enjoy~
------------------------------
原帖如下(http://boston.craigslist.org/nwb/bab/1892162461.html):
Breastfeeding Cover for new mother’s convenience
Wanted to share this great deal with you: go to uddercovers.com and use code
“cousin2” and it brings the price form $32 to $0. It has to be a limited
time thing. Good luck!
Jen |
|
|
n****i 发帖数: 26 | 23 Why there are so many recalls recently!
Massive Fisher Price Recall: Over 10 Mil Products
http://abcnews.go.com/Business/massive-fisher-price-recall-10-mil-products/story?id=11757016&page=2
Here's the list of products being recalled in the U.S., according to the
CPSC:
About 7 million Fisher Price Trikes and Tough Trikes toddler tricycles
About 950,000 Healthy Care, Easy Clean and Close to Me High Chairs
About 100,000 Fisher-Price Little People Wheelies Stand 'n Play Rampway
About 2.8 million Bab |
|
m*a 发帖数: 4927 | 24 我觉得很好用,one of the best bab stuff i used on my son... 我就在amazon买了
一堆large的,大概几十个,用在changing pad上,这样脏了扔了就好,不用洗 |
|
a*********0 发帖数: 218 | 25 跟着帖子问个问题,大家说的都是BAB IN A BAG的冬天版还是夏天版?还有就是小宝都
是多大开始用BABY IN A BAG的? |
|
r********s 发帖数: 556 | 26 从宝宝六个月开始加辅食。
现在11个月,我大体说一下宝宝一天得饮食。
早晨730起床,明显感觉他很饿。我先给他冲4OZ的奶粉。---这个4OZ有点少
了对吧,可是我家儿子就喝这么多,有时还能剩下一点点。然后放他到POTTI上,让
他POOP。一般能够CATCH。
9点下楼,我给他吃那种液体得酸奶,就是那个(dannon--danActive)。因为是液体
得,我一般往里加米糊(CEREAL),弄成固体得。那个一个小瓶是31OZ。加上米糊
儿,应该有4OZ了吧。对了,喂固体食物之前,我一般先给他喝水。水都是加了一点
果汁,否则他不是很渴不喝。他也就喝个15毫升到一OZ。这些他吃不饱得,然后我
喂他一些水果。我喂他的水果,主要有蓝莓,KIWI,苹果梨(用勺子刮了吃)。
11点,喝奶,照例,4OZ。睡午觉。一般2个小时。
1点,我给他吃我自己做的饭,一般就是面条。用排骨汤,把挂面掰得很短很短的
放在里边,做熟了。里边打个鸡蛋(搅碎了)。然后放点切得很碎的菜叶子,譬如,油
菜,白菜(这个要跟面条一起放),生菜等。
5点,喝奶,4OZ。
7点吃饭,有时是BABY FOOD,他一次能吃6OZ(怪了... 阅读全帖 |
|
|
|
|
|
|
|
|
|
|
a*********r 发帖数: 116 | 36 1) Baby Bassinet -
Very Clean in Excellent condition(only used for a few month) - $ 28
2) diaper genie with one new refill - $8
$30 if you want both.
You can see photos at:
http://sfbay.craigslist.org/eby/bab/2545333382.html
我住在Fremont(Alameda county),California
有意者请站内联系,谢谢! |
|
|
|
m****o 发帖数: 5689 | 39 这个好cute呀,喜欢
老大时,我也在店里买各种泥。。。。现在怀老二,在target看中一套baby的bullet,
60刀样子。http://www.target.com/p/Bab........
★ Sent from iPhone App: iReader Mitbbs Lite 7.28 |
|
|
|
|
|
|
H*******5 发帖数: 1397 | 45 宝宝2𠆤多月了,泵奶器是每天用的最多的东西。尽管毎次用完都用BAB丫的洗
洁精淸洗,一周用微波炉消毒一次,但是洗不到的地方还是不放心,不知配件多久更换
一次比较卫生 |
|
|
|
A**********g 发帖数: 36 | 48 Chicago area only.
The First Years Via I450 Infant Carseat, Urban Life $80
Fisher-Price Ocean Wonders Bouncer $30
Fisher-Price Space Saver High Chair $40
Graco Pack 'N Play Playard with Carry Bag $80
Bought one year ago, Some Items in Original Box, All in Good Condition, Cash
Only.
http://chicago.craigslist.org/nwc/bab/3516750269.html
Thanks. |
|
g****r 发帖数: 302 | 49 The Best Natural Way to Clean Baby Bottles
转载自国家地理网站:
http://greenliving.nationalgeographic.com/natural-way-clean-bab
Learning how to feed your baby is just as important as understanding what to
feed her. Babies need to get their food and formula from extra-clean
bottles and feeding implements. If you're practicing a "green" lifestyle,
you may wonder how to create these conditions without resorting to chemical
cleaners or running an almost-empty dishwasher for the sake of a few clean
bottles. Bu... 阅读全帖 |
|
|