328. Odd Even Linked List Total Accepted: 9271 Total Submissions: 24497 Difficulty: Easy Given a singly linked list, group all odd nodes together foll ...
分类:
其他好文 时间:
2017-08-01 22:57:15
阅读次数:
113
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa ...
分类:
其他好文 时间:
2017-08-01 14:21:02
阅读次数:
116
1045 - Digits of Factorial Factorial of an integer is defined by the following function f(0) = 1 f(n) = f(n - 1) * n, if(n > 0) So, factorial of 5 is ...
分类:
其他好文 时间:
2017-08-01 09:51:31
阅读次数:
180
OJ题号: BZOJ4195、洛谷1955 思路: 首先将信息的下标离散化,首先处理$e=1$时的情况,直接用并查集合并。 对于$e=0$时的情况,判断两个是否在统一集合。 ...
分类:
其他好文 时间:
2017-07-31 10:09:20
阅读次数:
100
题目链接:https://leetcode.com/problems/3sum-closest/ 题目:Given an array S of n integers, find three integers in S such that the sum is closest to a given n ...
分类:
其他好文 时间:
2017-07-30 15:53:05
阅读次数:
116
OJ题号: BZOJ1834、洛谷2604 思路: 对于第一问,直接跑一遍最大流即可。 对于第二问,将每条边分成两种情况,即将每条边拆成两个: 不需扩容,即残量大于零时,相当于这条边费用为$0$; 需要扩容,即残量等于零时,可以扩容很多次,将残量设为$inf$或者$k$(实际上最多扩容$k$次)。 ...
分类:
其他好文 时间:
2017-07-30 15:45:40
阅读次数:
164
OJ题号: BZOJ1070、洛谷2053 思路: 最初的爆零解法: 每个工人向$S$连一条容量为$inf$、费用为$0$的边,(每个工人可以修很多车) 每个工人向每辆车连一条容量为$1$,费用等于题目描述的边,(一个工人只能修一次同一辆车) 每辆车向$T$连一条容量为$1$,费用为$0$的边。(每 ...
分类:
其他好文 时间:
2017-07-30 13:45:24
阅读次数:
118
Total Accepted: 69360 Total Submissions: 206274 Difficulty: Medium Given two integers n and k, return all possible combinations of k numbers out of 1 ...
分类:
其他好文 时间:
2017-07-29 14:09:22
阅读次数:
156
83. Remove Duplicates from Sorted List Total Accepted: 94387 Total Submissions: 264227 Difficulty: Easy 题目意思:如今有一个已经排好顺序的链表,删除全部反复的节点。使每一个节点都仅仅出现一次! G ...
分类:
其他好文 时间:
2017-07-28 13:33:19
阅读次数:
100
189. Rotate Array Total Accepted: 55073 Total Submissions: 278176 Difficulty: Easy Rotate an array of n elements to the right by k steps. For example, ...
分类:
其他好文 时间:
2017-07-27 15:57:38
阅读次数:
195