Embedded C# bitpacked arrays to low-level STM32F4 driver for GE G35 RGB LED Christmas tree light

Problem I’m going to be opensourcing some code I’m working on. I don’t need help with the code, I just […]

Counting initial bits of 0 in Java

Problem I want to count the number of bits set to 0 at the beginning of a byte array. So […]

What specific optimizations can be made to this BitArray class, and how can they be implemented?

Problem Here is the current code for the BitArray class needing optimization (implemented on big integers): import itertools ################################################################################ class […]

Codility binary gap solution

Problem This is how I solved the binary gap problem: Find longest sequence of zeros, bounded by ones, in binary […]

Encoding variable-length quanties for MIDI

Problem I was reading about the MIDI spec and I challenged myself to implement a function to convert an int32 […]

Return Y integer with same bit sets as X & having | X – Y | minimum value

Problem I happened to come across one question: Given an integer ‘x’ (Only positive), write an algorithm that returns integer […]

Check if a given integer is power of two

Problem Given an integer, check if it’s the power of two. class Main { static class Solution { private final […]

Bit exchange operation

Problem I have been working on a certain task these days and after several hours of torture, I have done […]

LeetCode: Sum of Two Integers C#

Problem https://leetcode.com/problems/sum-of-two-integers/ Calculate the sum of two integers a and b, but you are not allowed to use the operator […]

Counting the number of bits of a positive integer

Problem How can I improve this code for counting the number of bits of a positive integer n in Python? […]