Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 164 Bytes

BitFunctions - setBit.md

File metadata and controls

12 lines (9 loc) · 164 Bytes

Solution

int setBit(int num, int bit) {
    return num | (1 << bit);
}

Time/Space Complexity

  • Time Complexity: O(1)
  • Space Complexity O(1)