一道Google面试题,怎么做?(题目描述有误,已修改)# JobHunting - 待字闺中
m*0
1 楼
我之前的描述有问题,现在补充一下描述:
define: a distinct character in returned string means the character's number
of appearance equals one.
Given a string, find the length of longest sub-string(s) which contain at
most K distinct characters.
for example,
given string="AABBCC", K=1, return="AABBCC"
given string="AAXBBYCCC", K=1, return="BBYCCC"
想了半天只想到了O(n^2)的解法。各位有更好的办法没
define: a distinct character in returned string means the character's number
of appearance equals one.
Given a string, find the length of longest sub-string(s) which contain at
most K distinct characters.
for example,
given string="AABBCC", K=1, return="AABBCC"
given string="AAXBBYCCC", K=1, return="BBYCCC"
想了半天只想到了O(n^2)的解法。各位有更好的办法没