Machine Learning, AI and Programming

Tag: Consecutive Numbers Sum

Leetcode : Consecutive Numbers Sum

Problem Statement Solution: The brute force approach is to evaluate all possible sequence of consecutive numbers less than N, whose sum gives N. The number of all possible sequences of consecutive numbers less than N is O(N2), because we can select pair of indices i and j (i <= j) such that the sequence lies between i and j. The number of such pairs is O(N2). We can definitely improve […]

Continue Reading →