Skip to content

Instantly share code, notes, and snippets.

class Solution {
func longestSubstring(_ s: String, _ k: Int) -> Int {
let s = s.lowercased()
var info = [Int](repeating: 0, count: 26)
let chars = Array(s.utf8CString).map { Int($0 - "a".utf8CString.first!) }.filter{ $0 >= 0 }
for c in chars {
info[c] += 1
}
@dreamolight
dreamolight / gist:157266c615d4a226e772
Last active September 24, 2015 12:33
Core Data bug on iOS8 & iOS9 build via Xcode7
- (void)controller:(NSFetchedResultsController *)controller
didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath
forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath
{
if (![self isViewLoaded]) return;
switch(type)
{
case NSFetchedResultsChangeInsert: