Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Input: 5 O ...
分类:
其他好文 时间:
2018-07-11 19:39:49
阅读次数:
122
Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20404 Accepted: 9043 Description The Genographic Project is a research partnersh ...
分类:
其他好文 时间:
2018-07-09 23:14:58
阅读次数:
202
contenttypes 是Django内置的一个应用,可以追踪项目中所有app和model的对应关系,并记录在ContentType表中。 models.py文件的表结构写好后,通过makemigrations和migrate两条命令迁移数据后,在数据库中会自动生成一个django_content ...
分类:
其他好文 时间:
2018-07-09 23:14:42
阅读次数:
193
一个矩阵,自乘无限次后能否全为正数? 如果n比较小,可以二分一下,但是这里n很大,乘一次都无法接受 可以考虑实际含义:矩阵看成邻接矩阵,那么0就是没有边,其余就是有边。 我们知道邻接矩阵自乘k次就相当于在原图走k步,无限次后是否有0?也就是图能否强连通。 判断就好,整个是环的情况题目限制不存在。 ...
分类:
其他好文 时间:
2018-07-08 12:43:28
阅读次数:
121
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to ...
分类:
编程语言 时间:
2018-07-08 11:16:06
阅读次数:
161
首先认识一下01邻接矩阵k次幂的意义:经过k条边(x,y)之间的路径条数 所以可以把矩阵当成邻接矩阵,全是 0的话意味着两两之间都能相连,也就是整个都要在一个强连通分量里,所以直接tarjan染色,如果只有一个色块的话就是YES否则都是NO(其实应该能更简单一些,不过tarjan比较顺手) 还有就是 ...
分类:
其他好文 时间:
2018-07-07 14:29:44
阅读次数:
145
Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a g ...
分类:
其他好文 时间:
2018-07-07 12:36:24
阅读次数:
498
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino ...
分类:
其他好文 时间:
2018-07-06 12:15:29
阅读次数:
181
You are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map: You are asked to cut off ...
分类:
其他好文 时间:
2018-07-04 23:42:14
阅读次数:
226
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both ...
分类:
编程语言 时间:
2018-07-03 14:32:18
阅读次数:
970