注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
之前在地里看到了这道方块的面经题,请教大家
1. Given a list of Strings, determine if its a square matrix
- Ex. [
- “abcd”
- “bxdz”
- “cdef”
- “dzfg” ] where row 1 abcd = column 1, row 2 bxdz = column2 bxdz
- Follow up: Given a list of String, return all the square matrix which combined from the given list,
- Ex. [“abc”, “exd“,”bde” , “ceb”, ] return
- [[“abc” [“ceb”
- “Bde” “exd”
- “ceb”, “bde”]]
复制代码
请问这道题除了brute force还有什么好的解法吗
2 Parsing: Given a string like "Chris,Tom,Anne\nJerry,Tim,Daphne&ring"
3. 一个组合, 里面是[A, B], [B, A], [C, D], [D, E], [E, C] 这样的一对对, 让找所有能环起来的组合: ([A, B], [B, A] 能环起来, [C, D], [D, E], [E, C] 也能环起来)
|