Stokastik

Machine Learning, AI and Programming

Tag: Consecutive Ones

Leetcode : Non-negative Integers without Consecutive Ones

Problem Statement Solution: The brute force approach is to scan all the integers less than equals to N, compute their binary representation and check if the binary representation has consecutive ones or not. The run-time complexity of this approach is O(N*logN) because scanning all the integers less than N is O(N) and scanning the binary representation for each integer is O(logN), because binary representation of an integer M is of […]

Continue Reading →