This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(int)binaryGap:(int)N { | |
NSString *string = @""; | |
NSUInteger x = N; | |
while (x>0) { | |
string = [[NSString stringWithFormat: @"%lu", x&1] stringByAppendingString:string]; | |
x = x >> 1; | |
} | |
int longestBinaryGap = 0; | |
int binaryGapLength = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```swift | |
protocol OutsideTileContainerDelegate { | |
func outsideTileContainer(container: TileContainer) | |
} | |
class TileContainer: UIView { | |
//MARK: OutsideTileContainerDelegate | |
var delegate: OutsideTileContainerDelegate? | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class func createCustomItemView() -> CustomItemView? { | |
let bundle = NSBundle(forClass: CustomItemView.self) | |
let nib = UINib(nibName: "CustomItemView", bundle: bundle) | |
if let view = nib.instantiateWithOwner(self, options: nil).first as? CustomItemView { | |
return view | |
} | |
return nil | |
} | |
private class func addEqualConstraintsFromSubView(subView: UIView, toSuperView superView: UIView) { |