活跃农民
- 积分
- 405
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2018-10-12
- 最后登录
- 1970-1-1
|
Sep 3
string, 简单的就不打卡了
247.
# MEDIUM
# when n = 1
# we have ["1","0","8"]
# when n = 2:
# we have ["11","69","88","96","00"]
# n = 3:
# we have ["111","101","181","619","609","689","818","808","888","916","906","986"]
# which is ["1","0","8"] inserted in the mid of ["11","69","88","96","00"]
459
# EASY
# KMP
# only build prefix
# ex. input = ababa
# prefix[0] = 0
# prefix[1] = 0
# prefix[2] = 1 a,b,a
# prefix[3] = 2 ab ab
# prefix[4] = 3 aba aba
68
# HARD
# 1. check length + counts of word + current word with maxWidth
# 2. round robin
# maxWidth - lenght = number of spaces
# loop through number of spaces times
# each time assign a space to a word[0] -word[len]
# Time O(N) Space O(N)
|
|