发信人: nikkizeng (Nikki), 信区: JobHunting
标 题: 一道 facebook 电面题
发信站: BBS 未名空间站 (Sun Apr 13 20:50:35 2014, 美东)
Given a sequence of distinct integers, your program must remove as few
elements as possible in order for the elements which are not removed to
appear in ascending order. If there is more than one way to do this, your
program must print one solution, then print the number of all solutions.
Example.
Given 1 2 3 8 10 5 6 7 12 9 11 4 0
Remove 8 10 12 4 0
Remain 1 2 3 5 6 7 9 11 (ascending)
To form an ascending sequence, you must remove at least 5 elements. There is
only one way to do it.
不太理解print the number of all solutions.难道要先找出max length of the
substring,然后再来找solution?
--
※ 修改:·nikkizeng 於 Apr 13 20:55:47 2014 修改本文·[FROM: 50.]
※ 来源:·WWW 未名空间站 网址:mitbbs.com 移动:在应用商店搜索未名空间·[FROM: 50.]
Sunday, June 8, 2014
一道 facebook 电面题
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment