Consider a graph G = ( N, E) and, for each node i ϵ N, let B i be a subset of {0, 1, …, d G ( i)}, where d G ( i) denotes the degree of node i in G. The general factor problem asks whether there exists a subgraph of G, say H = ( N, F), where F ⊆ E, such that d H ( i) ϵ B i for every i ϵ N. This problem is NP-complete. A set B i is said to have a gap of length p ≥ 1 if there exists an integer k ϵ B i such that k + 1, …, k + p ∉ B i and k + p + 1 ϵ B i . Lovàsz conjectured that the general factor problem can be solved in polynomial time when, in each B i , all the gaps (if any) have length one. We prove this conjecture. In cubic graphs, the result is obtained via a reduction to the edge-and-triangle partitioning problem. In general graphs, the proof uses an augmenting path theorem.