bit-manipulation

Provide deterministic bit-manipulation utilities for binary operations and bitmask DP.

3|Updated Nov 18, 2025
One-click install
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-data-structures-algorithms --skill bit-manipulation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bit-manipulation
Source: https://github.com/pluginagentmarketplace/custom-plugin-data-structures-algorithms/tree/main/skills/bitmanip
Command: npx skills add https://github.com/pluginagentmarketplace/custom-plugin-data-structures-algorithms --skill bit-manipulation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Bit-level operations are fundamental in high-performance algorithms and competitive programming. This section explains how bit tricks can optimize counting, masking, and pattern detection to reduce runtime and improve clarity.

Core Features & Use Cases

  • Set, clear, toggle, and test bits efficiently.
  • Count bits (including Kernighan's method) and reason about powers of two.
  • Generate bitmasks and subsets for DP problems, with examples from single-number and Hamming distance tasks.

Quick Start

Provide a number and have the bit-manipulation skill count its set bits using an efficient method.

Frequently Asked Questions about bit-manipulation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I count set bits efficiently for competitive programming?

Count set bits efficiently using Kernighan's method, a bit manipulation technique that clears the lowest set bit in each iteration to achieve O(number of set bits) complexity. The skill provides this as a core utility for fast problem solving.

What is the best way to generate all subsets for bitmask dynamic programming?

Generate all subsets for bitmask DP by iterating through bitmask combinations and applying binary operations to enumerate set states. The skill provides utilities to generate bitmasks and subsets, enabling efficient state representation in dynamic programming problems.

How do I set, clear, and toggle bits using binary operations?

Set, clear, and toggle bits using binary operations like OR, AND, and XOR with specific bitmask patterns. The skill covers core bit operations including set, clear, toggle, and bit tests, enforcing strict input validation for numeric parameters.

Can I use bit manipulation to solve the single number and Hamming distance problems?

Solve single number and Hamming distance problems using XOR tricks to identify unique elements or count differing bits. The skill includes object-level examples for both tasks, demonstrating practical applications of binary operations.

Does this skill support configurable retry and logging for bit operations?

Configurable retry and logging are supported for bit operations, ensuring deterministic execution and traceability. The skill enforces strict input validation for numeric parameters and documents complexity for key operations.

When should I use bit manipulation instead of standard arithmetic in algorithm design?

Use bit manipulation instead of standard arithmetic when optimizing for speed and deterministic performance, as binary operations run in constant time. The skill is designed for high-performance algorithms and competitive programming where runtime reduction is critical.