Bit Manipulation

//Bit Manipulation
­

Bit Manipulation

This post introduces basic operations and tricks about bit manipulation.

November 14th, 2015|Categories: Bit Manipulation, DS and Algorithms|Tags: , |

[Leetcode] Power of Two

Given an integer, write a function to determine if it is a power of two.

November 14th, 2015|Categories: Bit Manipulation, DS and Algorithms, Math|Tags: , , , |

[Leetcode] Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1' bits it has.

November 14th, 2015|Categories: Bit Manipulation, DS and Algorithms, Math|Tags: , , , |

[Leetcode] Reverse Bits

Reverse bits of a given 32 bits unsigned integer.

November 14th, 2015|Categories: Bit Manipulation, DS and Algorithms|Tags: , , , |

[Leetcode] Single Number

Given an array of integers, every element appears twice except for one. Find that single one.

November 23rd, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Single Number II

Given an array of integers, every element appears three times except for one. Find that single one.

November 25th, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Single Number III

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.

November 26th, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , |

[Leetcode] Repeated DNA Sequences

Write a function to find all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule.

November 29th, 2015|Categories: Bit Manipulation, DS and Algorithms, Hash|Tags: , , , |

[Leetcode] Bitwise AND of Numbers Range

Given a range [m, n], return the bitwise AND of all numbers in this range, inclusive.

November 30th, 2015|Categories: Bit Manipulation, DS and Algorithms|Tags: , , , |