SHARE
TWEET

Untitled

a guest Sep 20th, 2011 498 Never
  1. /*
  2.  * fitsBits - return 1 if x can be represented as an
  3.  *  n-bit, two's complement integer.
  4.  *   1 <= n <= 32
  5.  *   Examples: fitsBits(5,3) = 0, fitsBits(-4,3) = 1
  6.  *   Legal ops: ! ~ & ^ | + << >>
  7.  *   Max ops: 15
  8.  *   Rating: 2
  9.  */
  10. int fitsBits(int x, int n) {
  11.   return 2;
  12. }
RAW Paste Data
Top