题意:N个参加聚会,和一个数组a,ai表示第i个人讨厌的人,如果一个到聚会门口的时候发现他讨厌的人已经在聚会里面,则他不会参加聚会,否则他会参加聚会。ai==i表示他没有讨厌的人。N个人来的先后顺序是任意的,也就是说n个来的先后顺序构成的1到n的排列是任意的。问参加聚会的人的期望是多少?...
分类:
其他好文 时间:
2015-08-05 20:27:00
阅读次数:
382
The Bootstrap grid system has four classes:xs: extra small screens (mobile phones)sm: small screens (tablets)md: medium screens (normal desktops)lg: l...
分类:
其他好文 时间:
2015-08-05 20:11:43
阅读次数:
126
Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota...
分类:
其他好文 时间:
2015-08-05 19:57:54
阅读次数:
123
本来我在 7 月 18 号的时候就已经在 Medium 的热点推荐中看到这篇文章的了,但是当时觉得这种文章就是哗众取宠,在 Medium 上应该也是昙花一现而已,所以没有仔细去查看。但是昨天上 Medium 时一看,发现这篇文章竟然还在热点推荐栏目! 通常,在 Medium 这个世界著名的媒体上面....
分类:
其他好文 时间:
2015-08-05 12:31:48
阅读次数:
135
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Given n = 13,Return 6...
分类:
其他好文 时间:
2015-08-04 20:58:01
阅读次数:
110
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ...
分类:
其他好文 时间:
2015-08-04 20:53:28
阅读次数:
100
Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv...
分类:
其他好文 时间:
2015-08-04 20:44:27
阅读次数:
193
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted in asc...
分类:
其他好文 时间:
2015-08-04 19:00:16
阅读次数:
84
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th...
分类:
其他好文 时间:
2015-08-03 18:29:53
阅读次数:
163
三. iOS应用架构谈(三):网络层设计方案(上)http://www.infoq.com/cn/articles/ios-app-arch-3-1?utm_source=infoq&utm_medium=popular_widget&utm_campaign=popular_content_lis...
分类:
移动开发 时间:
2015-07-31 00:55:37
阅读次数:
154