Skip to content

Instantly share code, notes, and snippets.

View fabriziobagala's full-sized avatar
🏠
Working from home

Fabrizio Bagalà fabriziobagala

🏠
Working from home
View GitHub Profile
@fabriziobagala
fabriziobagala / BinaryGap.cs
Created May 9, 2020 17:27
Find longest sequence of zeros in binary representation of an integer.
using System;
class Solution
{
public int solution(int N)
{
const int mask = 1;
var binaryGap = 0;
int? currentBinaryGap = null;